chiark / gitweb /
journal: use _cleanup_
[elogind.git] / src / udev / scsi_id / scsi_serial.c
index 6bfb7f780cbf204e1e5692e9977e6c587a596b1d..d522a23a088c0af01145d0d2ee0c8eeb953fdf0d 100644 (file)
@@ -436,7 +436,7 @@ static int do_scsi_page0_inquiry(struct udev *udev,
                  * If the vendor id appears in the page assume the page is
                  * invalid.
                  */
-                if (!strncmp((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) {
+                if (strneq((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) {
                         log_debug("%s: invalid page0 data\n", dev_scsi->kernel);
                         return 1;
                 }
@@ -469,10 +469,10 @@ static int prepend_vendor_model(struct udev *udev,
         return ind;
 }
 
-/**
+/*
  * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill
  * serial number.
- **/
+ */
 static int check_fill_0x83_id(struct udev *udev,
                               struct scsi_id_device *dev_scsi,
                               unsigned char *page_83,
@@ -799,6 +799,7 @@ static int do_scsi_page80_inquiry(struct udev *udev,
                 ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]);
                 if (ser_ind < 0)
                         return 1;
+                ser_ind++; /* for the leading 'S' */
                 for (i = 4; i < len + 4; i++, ser_ind++)
                         serial[ser_ind] = buf[i];
         }
@@ -920,7 +921,8 @@ int scsi_get_serial(struct udev *udev,
                 }
         } else if (page_code != 0x00) {
                 log_debug("%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code);
-                return 1;
+                retval = 1;
+                goto completed;
         }
 
         /*