.. | .. |
---|
1516 | 1516 | } |
---|
1517 | 1517 | |
---|
1518 | 1518 | /** |
---|
1519 | | - * strip_and_pad_whitespace - Strip and pad trailing whitespace. |
---|
1520 | | - * @i: index into buffer |
---|
1521 | | - * @buf: string to modify |
---|
| 1519 | + * strip_whitespace - Strip and pad trailing whitespace. |
---|
| 1520 | + * @i: size of buffer |
---|
| 1521 | + * @buf: string to modify |
---|
1522 | 1522 | * |
---|
1523 | | - * This function will strip all trailing whitespace, pad the end |
---|
1524 | | - * of the string with a single space, and NULL terminate the string. |
---|
| 1523 | + * This function will strip all trailing whitespace and |
---|
| 1524 | + * NUL terminate the string. |
---|
1525 | 1525 | * |
---|
1526 | | - * Return value: |
---|
1527 | | - * new length of string |
---|
1528 | 1526 | **/ |
---|
1529 | | -static int strip_and_pad_whitespace(int i, char *buf) |
---|
| 1527 | +static void strip_whitespace(int i, char *buf) |
---|
1530 | 1528 | { |
---|
| 1529 | + if (i < 1) |
---|
| 1530 | + return; |
---|
| 1531 | + i--; |
---|
1531 | 1532 | while (i && buf[i] == ' ') |
---|
1532 | 1533 | i--; |
---|
1533 | | - buf[i+1] = ' '; |
---|
1534 | | - buf[i+2] = '\0'; |
---|
1535 | | - return i + 2; |
---|
| 1534 | + buf[i+1] = '\0'; |
---|
1536 | 1535 | } |
---|
1537 | 1536 | |
---|
1538 | 1537 | /** |
---|
.. | .. |
---|
1547 | 1546 | static void ipr_log_vpd_compact(char *prefix, struct ipr_hostrcb *hostrcb, |
---|
1548 | 1547 | struct ipr_vpd *vpd) |
---|
1549 | 1548 | { |
---|
1550 | | - char buffer[IPR_VENDOR_ID_LEN + IPR_PROD_ID_LEN + IPR_SERIAL_NUM_LEN + 3]; |
---|
1551 | | - int i = 0; |
---|
| 1549 | + char vendor_id[IPR_VENDOR_ID_LEN + 1]; |
---|
| 1550 | + char product_id[IPR_PROD_ID_LEN + 1]; |
---|
| 1551 | + char sn[IPR_SERIAL_NUM_LEN + 1]; |
---|
1552 | 1552 | |
---|
1553 | | - memcpy(buffer, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN); |
---|
1554 | | - i = strip_and_pad_whitespace(IPR_VENDOR_ID_LEN - 1, buffer); |
---|
| 1553 | + memcpy(vendor_id, vpd->vpids.vendor_id, IPR_VENDOR_ID_LEN); |
---|
| 1554 | + strip_whitespace(IPR_VENDOR_ID_LEN, vendor_id); |
---|
1555 | 1555 | |
---|
1556 | | - memcpy(&buffer[i], vpd->vpids.product_id, IPR_PROD_ID_LEN); |
---|
1557 | | - i = strip_and_pad_whitespace(i + IPR_PROD_ID_LEN - 1, buffer); |
---|
| 1556 | + memcpy(product_id, vpd->vpids.product_id, IPR_PROD_ID_LEN); |
---|
| 1557 | + strip_whitespace(IPR_PROD_ID_LEN, product_id); |
---|
1558 | 1558 | |
---|
1559 | | - memcpy(&buffer[i], vpd->sn, IPR_SERIAL_NUM_LEN); |
---|
1560 | | - buffer[IPR_SERIAL_NUM_LEN + i] = '\0'; |
---|
| 1559 | + memcpy(sn, vpd->sn, IPR_SERIAL_NUM_LEN); |
---|
| 1560 | + strip_whitespace(IPR_SERIAL_NUM_LEN, sn); |
---|
1561 | 1561 | |
---|
1562 | | - ipr_hcam_err(hostrcb, "%s VPID/SN: %s\n", prefix, buffer); |
---|
| 1562 | + ipr_hcam_err(hostrcb, "%s VPID/SN: %s %s %s\n", prefix, |
---|
| 1563 | + vendor_id, product_id, sn); |
---|
1563 | 1564 | } |
---|
1564 | 1565 | |
---|
1565 | 1566 | /** |
---|
.. | .. |
---|
10870 | 10871 | **/ |
---|
10871 | 10872 | static int __init ipr_init(void) |
---|
10872 | 10873 | { |
---|
| 10874 | + int rc; |
---|
| 10875 | + |
---|
10873 | 10876 | ipr_info("IBM Power RAID SCSI Device Driver version: %s %s\n", |
---|
10874 | 10877 | IPR_DRIVER_VERSION, IPR_DRIVER_DATE); |
---|
10875 | 10878 | |
---|
10876 | 10879 | register_reboot_notifier(&ipr_notifier); |
---|
10877 | | - return pci_register_driver(&ipr_driver); |
---|
| 10880 | + rc = pci_register_driver(&ipr_driver); |
---|
| 10881 | + if (rc) { |
---|
| 10882 | + unregister_reboot_notifier(&ipr_notifier); |
---|
| 10883 | + return rc; |
---|
| 10884 | + } |
---|
| 10885 | + |
---|
| 10886 | + return 0; |
---|
10878 | 10887 | } |
---|
10879 | 10888 | |
---|
10880 | 10889 | /** |
---|