[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201012080843.7kh4xdk4ymaetza6@Rk>
Date: Mon, 12 Oct 2020 16:08:43 +0800
From: Coiby Xu <coiby.xu@...il.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: devel@...verdev.osuosl.org,
Benjamin Poirier <benjamin.poirier@...il.com>,
Shung-Hsi Yu <shung-hsi.yu@...e.com>,
Manish Chopra <manishc@...vell.com>,
"supporter:QLOGIC QLGE 10Gb ETHERNET DRIVER"
<GR-Linux-NIC-Dev@...vell.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
open list <linux-kernel@...r.kernel.org>,
"open list:QLOGIC QLGE 10Gb ETHERNET DRIVER" <netdev@...r.kernel.org>
Subject: Re: [PATCH v1 1/6] staging: qlge: Initialize devlink health dump
framework for the dlge driver
On Thu, Oct 08, 2020 at 08:22:44AM -0400, Willem de Bruijn wrote:
>On Thu, Oct 8, 2020 at 7:58 AM Coiby Xu <coiby.xu@...il.com> wrote:
>>
>> Initialize devlink health dump framework for the dlge driver so the
>> coredump could be done via devlink.
>>
>> Signed-off-by: Coiby Xu <coiby.xu@...il.com>
>
>> @@ -4556,6 +4559,13 @@ static int qlge_probe(struct pci_dev *pdev,
>> struct ql_adapter *qdev = NULL;
>> static int cards_found;
>> int err = 0;
>> + struct devlink *devlink;
>> + struct qlge_devlink *ql_devlink;
>> +
>> + devlink = devlink_alloc(&qlge_devlink_ops, sizeof(struct qlge_devlink));
>> + if (!devlink)
>> + return -ENOMEM;
>> + ql_devlink = devlink_priv(devlink);
>>
>> ndev = alloc_etherdev_mq(sizeof(struct ql_adapter),
>> min(MAX_CPUS,
>
>need to goto devlink_free instead of return -ENOMEM here, too.
devlink_alloc return NULL only if kzalloc return NULL. So we
shouldn't go to devlink_free which will call kfree.
>
>> @@ -4614,6 +4624,16 @@ static int qlge_probe(struct pci_dev *pdev,
>> free_netdev(ndev);
>> return err;
>
>and here
But I should goto devlink_free here. Thank you for pointing out my
neglect.
>
>> }
>> +
>> + err = devlink_register(devlink, &pdev->dev);
>> + if (err) {
>> + goto devlink_free;
>> + }
>> +
>> + qlge_health_create_reporters(ql_devlink);
>> + ql_devlink->qdev = qdev;
>> + ql_devlink->ndev = ndev;
>> + qdev->ql_devlink = ql_devlink;
>> /* Start up the timer to trigger EEH if
>> * the bus goes dead
>> */
>> @@ -4624,6 +4644,10 @@ static int qlge_probe(struct pci_dev *pdev,
>> atomic_set(&qdev->lb_count, 0);
>> cards_found++;
>> return 0;
>> +
>> +devlink_free:
>> + devlink_free(devlink);
>> + return err;
>> }
--
Best regards,
Coiby
Powered by blists - more mailing lists