[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250107102311.3552206-1-gur.stavi@huawei.com>
Date: Tue, 7 Jan 2025 12:23:11 +0200
From: Gur Stavi <gur.stavi@...wei.com>
To: <sumang@...vell.com>
CC: <andrew+netdev@...n.ch>, <cai.huoqing@...ux.dev>, <corbet@....net>,
<davem@...emloft.net>, <edumazet@...gle.com>, <gongfan1@...wei.com>,
<guoxin09@...wei.com>, <gur.stavi@...wei.com>, <helgaas@...nel.org>,
<horms@...nel.org>, <kuba@...nel.org>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <meny.yossefi@...wei.com>,
<netdev@...r.kernel.org>, <pabeni@...hat.com>, <shenchenyang1@...ilicon.com>,
<shijing34@...wei.com>, <wulike1@...wei.com>, <zhoushuai28@...wei.com>
Subject: RE: [EXTERNAL] [PATCH net-next v03 1/1] hinic3: module initialization and tx/rx logic
> >+static struct hinic3_adev *hinic3_add_one_adev(struct hinic3_hwdev
> >*hwdev,
> >+ enum hinic3_service_type svc_type)
> >+{
> >+ struct hinic3_adev *hadev;
> >+ const char *svc_name;
> >+ int ret;
> >+
> >+ hadev =3D kzalloc(sizeof(*hadev), GFP_KERNEL);
> >+ if (!hadev)
> >+ return NULL;
> >+
> >+ svc_name =3D hinic3_adev_devices[svc_type].name;
> >+ hadev->adev.name =3D svc_name;
> >+ hadev->adev.id =3D hwdev->dev_id;
> >+ hadev->adev.dev.parent =3D hwdev->dev;
> >+ hadev->adev.dev.release =3D hinic3_comm_adev_release;
> >+ hadev->svc_type =3D svc_type;
> >+ hadev->hwdev =3D hwdev;
> >+
> >+ ret =3D auxiliary_device_init(&hadev->adev);
> >+ if (ret) {
> >+ dev_err(hwdev->dev, "failed init adev %s %u\n",
> >+ svc_name, hwdev->dev_id);
> >+ kfree(hadev);
> >+ return NULL;
> >+ }
> >+
> >+ ret =3D auxiliary_device_add(&hadev->adev);
> >+ if (ret) {
> >+ dev_err(hwdev->dev, "failed to add adev %s %u\n",
> >+ svc_name, hwdev->dev_id);
> >+ auxiliary_device_uninit(&hadev->adev);
> [Suman] memleak for hadev?
No. Calling auxiliary_device_uninit after a successful
auxiliary_device_init will trigger a call to hinic3_comm_adev_release
that releases the memory.
> >+ return NULL;
> >+ }
> >+
> >+ return hadev;
> >+}
> >+
Powered by blists - more mailing lists