Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[sfrench/cifs-2.6.git] / drivers / scsi / ipr.c
index 198d3f20d682887cf550b2d6bfadcc95b4db7cb1..c74053f0b72f464d2cae1cf694a116d932d22501 100644 (file)
@@ -1516,23 +1516,22 @@ static void ipr_process_ccn(struct ipr_cmnd *ipr_cmd)
 }
 
 /**
- * strip_and_pad_whitespace - Strip and pad trailing whitespace.
- * @i:         index into buffer
- * @buf:               string to modify
+ * strip_whitespace - Strip and pad trailing whitespace.
+ * @i:         size of buffer
+ * @buf:       string to modify
  *
- * This function will strip all trailing whitespace, pad the end
- * of the string with a single space, and NULL terminate the string.
+ * This function will strip all trailing whitespace and
+ * NUL terminate the string.
  *
- * Return value:
- *     new length of string
  **/
-static int strip_and_pad_whitespace(int i, char *buf)
+static void strip_whitespace(int i, char *buf)
 {
+       if (i < 1)
+               return;
+       i--;
        while (i && buf[i] == ' ')
                i--;
-       buf[i+1] = ' ';
-       buf[i+2] = '\0';
-       return i + 2;
+       buf[i+1] = '\0';
 }
 
 /**
@@ -1547,19 +1546,21 @@ static int strip_and_pad_whitespace(int i, char *buf)
 static void ipr_log_vpd_compact(char *prefix, struct ipr_hostrcb *hostrcb,
                                struct ipr_vpd *vpd)
 {
-       char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN + IPR_SERIAL_NUM_LEN + 3];
-       int i = 0;
+       char vendor_id[IPR_VENDOR_ID_LEN + 1];
+       char product_id[IPR_PROD_ID_LEN + 1];
+       char sn[IPR_SERIAL_NUM_LEN + 1];
 
-       memcpy(buffer, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN);
-       i = strip_and_pad_whitespace(IPR_VENDOR_ID_LEN - 1, buffer);
+       memcpy(vendor_id, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN);
+       strip_whitespace(IPR_VENDOR_ID_LEN, vendor_id);
 
-       memcpy(&buffer[i], vpd->vpids.product_id, IPR_PROD_ID_LEN);
-       i = strip_and_pad_whitespace(i + IPR_PROD_ID_LEN - 1, buffer);
+       memcpy(product_id, vpd->vpids.product_id, IPR_PROD_ID_LEN);
+       strip_whitespace(IPR_PROD_ID_LEN, product_id);
 
-       memcpy(&buffer[i], vpd->sn, IPR_SERIAL_NUM_LEN);
-       buffer[IPR_SERIAL_NUM_LEN + i] = '\0';
+       memcpy(sn, vpd->sn, IPR_SERIAL_NUM_LEN);
+       strip_whitespace(IPR_SERIAL_NUM_LEN, sn);
 
-       ipr_hcam_err(hostrcb, "%s VPID/SN: %s\n", prefix, buffer);
+       ipr_hcam_err(hostrcb, "%s VPID/SN: %s %s %s\n", prefix,
+                    vendor_id, product_id, sn);
 }
 
 /**
@@ -9495,11 +9496,10 @@ static pci_ers_result_t ipr_pci_error_detected(struct pci_dev *pdev,
  * This function takes care of initilizing the adapter to the point
  * where it can accept new commands.
  * Return value:
- *     0 on success / -EIO on failure
+ *     none
  **/
-static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
+static void ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
 {
-       int rc = 0;
        unsigned long host_lock_flags = 0;
 
        ENTER;
@@ -9515,7 +9515,6 @@ static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
        spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags);
 
        LEAVE;
-       return rc;
 }
 
 /**
@@ -10558,12 +10557,7 @@ static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
                return rc;
 
        ioa_cfg = pci_get_drvdata(pdev);
-       rc = ipr_probe_ioa_part2(ioa_cfg);
-
-       if (rc) {
-               __ipr_remove(pdev);
-               return rc;
-       }
+       ipr_probe_ioa_part2(ioa_cfg);
 
        rc = scsi_add_host(ioa_cfg->host, &pdev->dev);