Skip to content

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

Open
sahmed-ibm wants to merge 2 commits into
linux-nvme:masterfrom
sahmed-ibm:fix-wdc-nvme-dead-assignment_ret_1525
Open

wdc-nvme: fix dead assignment in wdc_get_pci_ids()#3582
sahmed-ibm wants to merge 2 commits 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

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

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>
@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
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