All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: tianx <tianx@yunsilicon.com>
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, davem@davemloft.net,
	jeff.johnson@oss.qualcomm.com, przemyslaw.kitszel@intel.com,
	weihg@yunsilicon.com, wanry@yunsilicon.com, horms@kernel.org,
	parthiban.veerasooran@microchip.com, masahiroy@kernel.org
Subject: Re: [PATCH v4 07/14] net-next/yunsilicon: Init auxiliary device
Date: Sun, 16 Feb 2025 11:59:15 +0200	[thread overview]
Message-ID: <20250216095915.GT17863@unreal> (raw)
In-Reply-To: <0e83c125-b69e-46a0-a760-fe090b53bc70@yunsilicon.com>

On Fri, Feb 14, 2025 at 11:14:45AM +0800, tianx wrote:
> On 2025/2/13 22:37, Leon Romanovsky wrote:
> > On Thu, Feb 13, 2025 at 05:14:19PM +0800, Xin Tian wrote:
> >> Initialize eth auxiliary device when pci probing
> >>
> >> Co-developed-by: Honggang Wei <weihg@yunsilicon.com>
> >> Signed-off-by: Honggang Wei <weihg@yunsilicon.com>
> >> Co-developed-by: Lei Yan <jacky@yunsilicon.com>
> >> Signed-off-by: Lei Yan <jacky@yunsilicon.com>
> >> Signed-off-by: Xin Tian <tianx@yunsilicon.com>
> >> ---
> >>   .../ethernet/yunsilicon/xsc/common/xsc_core.h |  12 ++
> >>   .../net/ethernet/yunsilicon/xsc/pci/Makefile  |   3 +-
> >>   .../net/ethernet/yunsilicon/xsc/pci/adev.c    | 110 ++++++++++++++++++
> >>   .../net/ethernet/yunsilicon/xsc/pci/adev.h    |  14 +++
> >>   .../net/ethernet/yunsilicon/xsc/pci/main.c    |  10 ++
> >>   5 files changed, 148 insertions(+), 1 deletion(-)
> >>   create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/adev.c
> >>   create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/adev.h
> > <...>

<...>

> >> +	[XSC_ADEV_IDX_ETH] = XSC_ETH_ADEV_NAME,
> >> +};
> >> +
> >> +static void xsc_release_adev(struct device *dev)
> >> +{
> >> +	/* Doing nothing, but auxiliary bus requires a release function */
> >> +}
> > It is unlikely to be true in driver lifetime model. At least you should
> > free xsc_adev here.
> >
> > Thanks
> 
> Hi Leon, xsc_adev has already been freed after calling 
> auxiliary_device_uninit. If I free it again in the release callback, it 
> will cause a double free.

You should follow standard driver lifetime model. Your
auxiliary_device_uninit() is wrong and shouldn't exist from the
beginning.

Thanks

  reply	other threads:[~2025-02-16  9:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13  9:14 [PATCH v4 00/14] net-next/yunsilicon: ADD Yunsilicon XSC Ethernet Driver Xin Tian
2025-02-13  9:14 ` [PATCH v4 01/14] net-next/yunsilicon: Add xsc driver basic framework Xin Tian
2025-02-13  9:14 ` [PATCH v4 02/14] net-next/yunsilicon: Enable CMDQ Xin Tian
2025-02-13  9:14 ` [PATCH v4 03/14] net-next/yunsilicon: Add hardware setup APIs Xin Tian
2025-02-13  9:14 ` [PATCH v4 04/14] net-next/yunsilicon: Add qp and cq management Xin Tian
2025-02-18 16:31   ` Simon Horman
2025-02-20  8:58     ` tianx
2025-02-13  9:14 ` [PATCH v4 05/14] net-next/yunsilicon: Add eq and alloc Xin Tian
2025-02-18 17:10   ` Simon Horman
2025-02-20 15:35     ` tianx
2025-02-24 18:58       ` Simon Horman
2025-02-25  2:34         ` Xin Tian
2025-02-25 10:22           ` Simon Horman
2025-02-13  9:14 ` [PATCH v4 06/14] net-next/yunsilicon: Add pci irq Xin Tian
2025-02-13  9:14 ` [PATCH v4 07/14] net-next/yunsilicon: Init auxiliary device Xin Tian
2025-02-13 14:37   ` Leon Romanovsky
2025-02-14  3:14     ` tianx
2025-02-16  9:59       ` Leon Romanovsky [this message]
2025-02-17  2:16         ` tianx
2025-02-13  9:14 ` [PATCH v4 08/14] net-next/yunsilicon: Add ethernet interface Xin Tian
2025-02-13  9:14 ` [PATCH v4 09/14] net-next/yunsilicon: Init net device Xin Tian
2025-02-13  9:14 ` [PATCH v4 10/14] net-next/yunsilicon: Add eth needed qp and cq apis Xin Tian
2025-02-13  9:14 ` [PATCH v4 11/14] net-next/yunsilicon: ndo_open and ndo_stop Xin Tian
2025-02-13  9:14 ` [PATCH v4 12/14] net-next/yunsilicon: Add ndo_start_xmit Xin Tian
2025-02-13  9:14 ` [PATCH v4 13/14] net-next/yunsilicon: Add eth rx Xin Tian
2025-02-13  9:14 ` [PATCH v4 14/14] net-next/yunsilicon: add ndo_get_stats64 Xin Tian

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=20250216095915.GT17863@unreal \
    --to=leon@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jeff.johnson@oss.qualcomm.com \
    --cc=kuba@kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=tianx@yunsilicon.com \
    --cc=wanry@yunsilicon.com \
    --cc=weihg@yunsilicon.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.