pasemi: fix PCI device reference leaks in pas_setup_mce_regs
Subsystems (2)
PATCH 1/1 pasemi: fix PCI device reference leaks in pas_setup_mce_regs
Fix reference leaks where PCI device references obtained via pci_get_device() were not being released:
1. The while loop that iterates through 0xa00a devices was not releasing the final device reference when the loop terminates.
2. Single device lookups for 0xa001 and 0xa009 devices were not releasing their references after use.
Add missing pci_dev_put() calls to ensure all device references are properly released.
--- arch/powerpc/platforms/pasemi/setup.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/pasemi/setup.c +4 -0
@@ -169,6 +169,8 @@ static int __init pas_setup_mce_regs(void) dev =pci_get_device (PCI_VENDOR_ID_PASEMI ,0xa00a , dev); reg++; } +/* Release the last device reference from the while loop */ +pci_dev_put (dev); dev =pci_get_device (PCI_VENDOR_ID_PASEMI ,0xa001 ,NULL );if (dev && reg+4 <MAX_MCE_REGS ) {
@@ -185,6 +187,7 @@ static int __init pas_setup_mce_regs(void) mce_regs[reg].addr =pasemi_pci_getcfgaddr (dev,0xc1c ); reg++; } +pci_dev_put (dev); dev =pci_get_device (PCI_VENDOR_ID_PASEMI ,0xa009 ,NULL );if (dev && reg+2 <MAX_MCE_REGS ) {
@@ -195,6 +198,7 @@ static int __init pas_setup_mce_regs(void) mce_regs[reg].addr =pasemi_pci_getcfgaddr (dev,0x214 ); reg++; } +pci_dev_put (dev); num_mce_regs = reg;
Signature · 1 line
2.35.1
…
Quoted 2 lines
Add missing
pci_dev_put()calls to ensure all device references are properly released.
* Would you like to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/device.h#L1180
* How do you think about to append parentheses to the function name in the summary phrase?
Regards,
Markus
Quoted 6 lines · Markus Elfring
…
Quoted 2 lines
Add missing
pci_dev_put()calls to ensure all device references are properly released.
?
Quoted 2 lines
* Would you like to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/device.h#L1180
That won't work here at all.
Signature · 2 lines
js suse labs
Quoted 4 lines
Quoted 2 lines
* Would you like to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/device.h#L1180That won't work here at all.
Why do you think in this direction here?
Regards,
Markus
Quoted 4 lines · Markus Elfring
…
Quoted 2 lines
Add missing
pci_dev_put()calls to ensure all device references are properly released.
Quoted 8 lines
* Would you like to increase the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17-rc4/source/include/linux/device.h#L1180* How do you think about to append parentheses to the function name in the summary phrase?
Hi,
This is the semi-friendly patch-bot of Greg Kroah-Hartman.
Markus, you seem to have sent a nonsensical or otherwise pointless review comment to a patch submission on a Linux kernel developer mailing list. I strongly suggest that you not do this anymore. Please do not bother developers who are actively working to produce patches and features with comments that, in the end, are a waste of time.
Patch submitter, please ignore Markus's suggestion; you do not need to follow it at all. The person/bot/AI that sent it is being ignored by almost all Linux kernel maintainers for having a persistent pattern of behavior of producing distracting and pointless commentary, and inability to adapt to feedback. Please feel free to also ignore emails from them.
thanks,
greg k-h's patch email bot