wdc-nvme: fix dead assignment in wdc_get_pci_ids()#3582
Open
sahmed-ibm wants to merge 2 commits into
Open
Conversation
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>
Collaborator
|
What about replacing the 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... |
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
force-pushed
the
fix-wdc-nvme-dead-assignment_ret_1525
branch
from
July 17, 2026 19:32
e6fc9b2 to
4956e2c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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