From: Andrew Lunn <andrew@lunn.ch>
To: han.junyang@zte.com.cn
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
ran.ming@zte.com.cn, han.chengfei@zte.com.cn,
zhang.yanze@zte.com.cn
Subject: Re: [PATCH net-next v5 1/2] dinghai: add ZTE network driver support
Date: Mon, 1 Jun 2026 16:28:13 +0200 [thread overview]
Message-ID: <ae94bb6d-b341-4112-a914-533162f682e4@lunn.ch> (raw)
In-Reply-To: <20260601143002051rSxzNiN9iKNj5gsdema0a@zte.com.cn>
> +static void dh_pf_remove(struct pci_dev *pdev)
> +{
> + struct dh_core_dev *dh_dev = pci_get_drvdata(pdev);
> + struct devlink *devlink = priv_to_devlink(dh_dev);
> + struct zxdh_pf_device *pf_dev = dh_dev->priv;
> +
> + dev_info(&pdev->dev, "dh_pf remove start\n");
> +
> + dh_pf_pci_close(dh_dev);
> + mutex_destroy(&pf_dev->irq_lock);
> + mutex_destroy(&dh_dev->lock);
> + dh_core_free_priv(dh_dev);
> + devlink_free(devlink);
Think about the ordering. What does that devlink instance allow? At
some point you are going to add some ops. Do any of those ops need to
access the PCI device? Do they need the mutex? Access to priv?
> +static inline void dh_core_free_priv(struct dh_core_dev *dh_dev)
> +{
> + kfree(dh_dev->priv);
> + dh_dev->priv = NULL;
There should not be any need to set it to NULL. If you have called
dh_core_free_priv() you should be 100% sure you will not be accessing
it again.
Andrew
next prev parent reply other threads:[~2026-06-01 14:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 6:24 [PATCH net-next v5 0/2] Add ZTE DingHai Ethernet PF driver han.junyang
2026-06-01 6:30 ` [PATCH net-next v5 1/2] dinghai: add ZTE network driver support han.junyang
2026-06-01 14:21 ` Andrew Lunn
2026-06-01 14:28 ` Andrew Lunn [this message]
2026-06-01 6:34 ` [PATCH net-next v5 2/2] dinghai: add hardware register access and PCI capability scanning han.junyang
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=ae94bb6d-b341-4112-a914-533162f682e4@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=han.chengfei@zte.com.cn \
--cc=han.junyang@zte.com.cn \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ran.ming@zte.com.cn \
--cc=zhang.yanze@zte.com.cn \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®