summaryrefslogtreecommitdiff
path: root/src/udev/scsi_id/scsi_serial.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2017-10-04 23:01:32 +0900
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-04 16:01:32 +0200
commit4c701096002fff540d9ddb3b21398c551ac3af78 (patch)
tree537e654dc92baa5eed5b6ff69867114384ecfa47 /src/udev/scsi_id/scsi_serial.c
parent6d0aa4db7b33c9ce71b820c76428a1cfd24fb56f (diff)
downloadsystemd-4c701096002fff540d9ddb3b21398c551ac3af78.tar.gz
tree-wide: use IN_SET macro (#6977)
Diffstat (limited to 'src/udev/scsi_id/scsi_serial.c')
-rw-r--r--src/udev/scsi_id/scsi_serial.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c
index f007cc6001..b56a541f78 100644
--- a/src/udev/scsi_id/scsi_serial.c
+++ b/src/udev/scsi_id/scsi_serial.c
@@ -115,9 +115,8 @@ static int sg_err_category_new(struct udev *udev,
if (!scsi_status && !host_status && !driver_status)
return SG_ERR_CAT_CLEAN;
- if ((scsi_status == SCSI_CHECK_CONDITION) ||
- (scsi_status == SCSI_COMMAND_TERMINATED) ||
- ((driver_status & 0xf) == DRIVER_SENSE)) {
+ if (IN_SET(scsi_status, SCSI_CHECK_CONDITION, SCSI_COMMAND_TERMINATED) ||
+ (driver_status & 0xf) == DRIVER_SENSE) {
if (sense_buffer && (sb_len > 2)) {
int sense_key;
unsigned char asc;
@@ -143,9 +142,7 @@ static int sg_err_category_new(struct udev *udev,
return SG_ERR_CAT_SENSE;
}
if (host_status) {
- if ((host_status == DID_NO_CONNECT) ||
- (host_status == DID_BUS_BUSY) ||
- (host_status == DID_TIME_OUT))
+ if (IN_SET(host_status, DID_NO_CONNECT, DID_BUS_BUSY, DID_TIME_OUT))
return SG_ERR_CAT_TIMEOUT;
}
if (driver_status) {
@@ -215,7 +212,7 @@ static int scsi_dump_sense(struct udev *udev,
dev_scsi->kernel, sb_len, s - sb_len);
return -1;
}
- if ((code == 0x0) || (code == 0x1)) {
+ if (IN_SET(code, 0x0, 0x1)) {
sense_key = sense_buffer[2] & 0xf;
if (s < 14) {
/*
@@ -227,7 +224,7 @@ static int scsi_dump_sense(struct udev *udev,
}
asc = sense_buffer[12];
ascq = sense_buffer[13];
- } else if ((code == 0x2) || (code == 0x3)) {
+ } else if (IN_SET(code, 0x2, 0x3)) {
sense_key = sense_buffer[1] & 0xf;
asc = sense_buffer[2];
ascq = sense_buffer[3];