Skip to content

Commit 9ed4d6a

Browse files
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 438304a commit 9ed4d6a

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

plugins/wdc/wdc-nvme.c

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

17861786
cust_id = wdc_get_fw_cust_id(r, dev);
1787-
if (cust_id == WDC_INVALID_CUSTOMER_ID) {
1788-
fprintf(stderr, "%s: ERROR: WDC: invalid customer id\n", __func__);
1789-
return -1;
1790-
}
1787+
/* Can still determine some capabilities in this case, but log an error */
1788+
if (cust_id == WDC_INVALID_CUSTOMER_ID)
1789+
fprintf(stderr,
1790+
"%s: ERROR: WDC: invalid customer ID; device ID = %x\n",
1791+
__func__, read_device_id);
17911792

17921793
if ((cust_id == WDC_CUSTOMER_ID_0x1004) || (cust_id == WDC_CUSTOMER_ID_0x1008) ||
17931794
(cust_id == WDC_CUSTOMER_ID_0x1005) || (cust_id == WDC_CUSTOMER_ID_0x1304))
@@ -1866,10 +1867,11 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
18661867
WDC_DRIVE_CAP_REASON_ID | WDC_DRIVE_CAP_LOG_PAGE_DIR);
18671868

18681869
cust_id = wdc_get_fw_cust_id(r, dev);
1869-
if (cust_id == WDC_INVALID_CUSTOMER_ID) {
1870-
fprintf(stderr, "%s: ERROR: WDC: invalid customer id\n", __func__);
1871-
return -1;
1872-
}
1870+
/* Can still determine some capabilities in this case, but log an error */
1871+
if (cust_id == WDC_INVALID_CUSTOMER_ID)
1872+
fprintf(stderr,
1873+
"%s: ERROR: WDC: invalid customer ID; device ID = %x\n",
1874+
__func__, read_device_id);
18731875

18741876
if ((cust_id == WDC_CUSTOMER_ID_0x1004) ||
18751877
(cust_id == WDC_CUSTOMER_ID_0x1008) ||

plugins/wdc/wdc-nvme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ)
66
#define WDC_NVME
77

8-
#define WDC_PLUGIN_VERSION "2.14.2"
8+
#define WDC_PLUGIN_VERSION "2.14.3"
99
#include "cmd.h"
1010

1111
PLUGIN(NAME("wdc", "Western Digital vendor specific extensions", WDC_PLUGIN_VERSION),

0 commit comments

Comments
 (0)