Re: [PATCH net] net/qla3xxx: Use managed PCI device enablement

From: Myeonghun Pak

Date: Sun Sep 13 2026 - 16:40:18 EST


Thanks for the review. I'll keep the existing manual resource
management and add pci_disable_device() to ql3xxx_remove() in v2.

2026년 9월 13일 (일) 오전 10:46, Simon Horman <horms@xxxxxxxxxx>님이 작성:
>
> On Thu, Sep 10, 2026 at 11:32:19PM -0400, Myeonghun Pak wrote:
> > ql3xxx_probe() enables the PCI device and balances that reference on
> > probe failure. However, ql3xxx_remove() releases the mappings and PCI
> > regions without disabling the device, leaving the enable reference
> > held after unbind.
> >
> > Use pcim_enable_device() so the PCI device is disabled automatically on
> > probe failure and driver detach. Remove the explicit disable from the
> > probe error path to avoid disabling the managed device twice.
> >
> > Keep the existing manual cleanup of register mappings, PCI regions and
> > the netdev. These resources are released before the managed PCI disable
> > action runs.
> >
> > This issue was identified during our ongoing static-analysis research while
> > reviewing kernel code.
> >
> > Fixes: 5a4faa873782 ("[PATCH] qla3xxx NIC driver")
> > Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
> > Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> > Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
>
> I think that rather than introducing the use of managed resource APIs
> to this driver, which is not encouraged in Networking code [1],
> the preferred approach would be to add a pci_disable_device() call
> to ql3xxx_remove().
>
> [1] https://docs.kernel.org/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs
>
> "Using device-managed and cleanup.h constructs
>
> "Netdev remains skeptical about promises of all “auto-cleanup” APIs,
> including even devm_ helpers, historically. They are not the preferred
> style of implementation, merely an acceptable one.
>
> --
> pw-bot: changes-requested