]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/udev/scsi_id/scsi_serial.c
tree-wide: use IN_SET macro (#6977)
[thirdparty/systemd.git] / src / udev / scsi_id / scsi_serial.c
index f007cc6001b8a1c03cace1d7aa93a80baed6d52c..b56a541f7813d64097db97561550959528c6e872 100644 (file)
@@ -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];