Skip to content

Commit d16e8d8

Browse files
brandon-paupore-sndkigaw
authored andcommitted
wdc: invalid customer ID fix
The return value of this function represents what commands are supported by the target, so returning a -1 here incorrectly enables all capability checks. Instead, this updates the behavior to just log the error and continue to report the actual device capabilities. Reviewed-by: Jeffrey Lien <[email protected]> Signed-off-by: Brandon Paupore <[email protected]>
1 parent faeec14 commit d16e8d8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

plugins/wdc/wdc-nvme.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,10 +1794,11 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
17941794
capabilities |= WDC_DRIVE_CAP_D0_LOG_PAGE;
17951795

17961796
cust_id = wdc_get_fw_cust_id(r, dev);
1797-
if (cust_id == WDC_INVALID_CUSTOMER_ID) {
1798-
fprintf(stderr, "%s: ERROR: WDC: invalid customer id\n", __func__);
1799-
return -1;
1800-
}
1797+
/* Can still determine some capabilities in this case, but log an error */
1798+
if (cust_id == WDC_INVALID_CUSTOMER_ID)
1799+
fprintf(stderr,
1800+
"%s: ERROR: WDC: invalid customer ID; device ID = %x\n",
1801+
__func__, read_device_id);
18011802

18021803
if ((cust_id == WDC_CUSTOMER_ID_0x1004) || (cust_id == WDC_CUSTOMER_ID_0x1008) ||
18031804
(cust_id == WDC_CUSTOMER_ID_0x1005) || (cust_id == WDC_CUSTOMER_ID_0x1304))
@@ -1876,10 +1877,11 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
18761877
WDC_DRIVE_CAP_REASON_ID | WDC_DRIVE_CAP_LOG_PAGE_DIR);
18771878

18781879
cust_id = wdc_get_fw_cust_id(r, dev);
1879-
if (cust_id == WDC_INVALID_CUSTOMER_ID) {
1880-
fprintf(stderr, "%s: ERROR: WDC: invalid customer id\n", __func__);
1881-
return -1;
1882-
}
1880+
/* Can still determine some capabilities in this case, but log an error */
1881+
if (cust_id == WDC_INVALID_CUSTOMER_ID)
1882+
fprintf(stderr,
1883+
"%s: ERROR: WDC: invalid customer ID; device ID = %x\n",
1884+
__func__, read_device_id);
18831885

18841886
if ((cust_id == WDC_CUSTOMER_ID_0x1004) ||
18851887
(cust_id == WDC_CUSTOMER_ID_0x1008) ||

0 commit comments

Comments
 (0)