All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Myeonghun Pak <mhun512@gmail.com>
Cc: GR-Linux-NIC-Dev@marvell.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Ijae Kim <ae878000@gmail.com>
Subject: Re: [PATCH net] net/qla3xxx: Use managed PCI device enablement
Date: Sun, 13 Sep 2026 15:46:35 +0100	[thread overview]
Message-ID: <20260913144635.GK48209@horms.kernel.org> (raw)
In-Reply-To: <20260911033219.34566-1-mhun512@gmail.com>

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@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>

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

  reply	other threads:[~2026-09-13 14:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  3:32 [PATCH net] net/qla3xxx: Use managed PCI device enablement Myeonghun Pak
2026-09-13 14:46 ` Simon Horman [this message]
2026-09-13 20:39   ` Myeonghun Pak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260913144635.GK48209@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=ae878000@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhun512@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.