Skip to content

wdc-nvme: fix dead assignment in wdc_get_pci_ids()#3582

Merged
igaw merged 1 commit into
linux-nvme:masterfrom
sahmed-ibm:fix-wdc-nvme-dead-assignment_ret_1525
Jul 20, 2026
Merged

wdc-nvme: fix dead assignment in wdc_get_pci_ids()#3582
igaw merged 1 commit into
linux-nvme:masterfrom
sahmed-ibm:fix-wdc-nvme-dead-assignment_ret_1525

Conversation

@sahmed-ibm

Copy link
Copy Markdown
Contributor

After successfully reading the vendor sysfs file, ret is assigned 0, but this value is never read. The variable is
unconditionally overwritten by the subsequent read() call for the device ID file before it is used again.

Remove the dead assignment. No functional change.

Signed-off-by: Sarah Ahmed sarah.ahmed@ibm.com

@igaw

igaw commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

What about replacing the wdc_get_pci_ids implementation with the newly added:

int nvme_get_pci_ids(struct libnvme_global_ctx *ctx,
		struct libnvme_transport_handle *hdl,
		__u32 *vid, __u32 *did,
		__u32 *subsys_vid, __u32 *subsys_did,
		__u32 *class_code);

more common code and works also on windows...

@sahmed-ibm

Copy link
Copy Markdown
Contributor Author

That should work I believe. I'll work on making this change

@sahmed-ibm
sahmed-ibm force-pushed the fix-wdc-nvme-dead-assignment_ret_1525 branch from e6fc9b2 to 4956e2c Compare July 17, 2026 19:32
Remove the WDC-local wdc_get_pci_ids() implementation and replace
all 13 call sites with the new common nvme_get_pci_ids() introduced
in nvme-pci-ids.h. The new function implements the same sysfs-based
PCI ID lookup but works cross-platform (including Windows) and is
shared across plugins.

Note the argument order change: wdc_get_pci_ids() took
(*ctx, *hdl, *device_id, *vendor_id) while nvme_get_pci_ids()
takes (*ctx, *hdl, *vid, *did, *subsys_vid, *subsys_did,
*class_code). The three unused output parameters are passed
as NULL.

No functional change intended.

Signed-off-by: Sarah Ahmed <sarah.ahmed@ibm.com>
@igaw
igaw force-pushed the fix-wdc-nvme-dead-assignment_ret_1525 branch from 4956e2c to a9182fe Compare July 20, 2026 08:08
@igaw
igaw merged commit 42ca98a into linux-nvme:master Jul 20, 2026
31 of 32 checks passed
@igaw

igaw commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

I've drop the first patch, as the change was removed afterwards anyway.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants