Re: [PATCH v1 1/6] staging: qlge: Initialize devlink health dump framework for the dlge driver

From: Coiby Xu
Date: Thu Oct 08 2020 - 08:54:38 EST


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@xxxxxxxxx> 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@xxxxxxxxx>

@@ -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.

@@ -4614,6 +4624,16 @@ static int qlge_probe(struct pci_dev *pdev,
free_netdev(ndev);
return err;

and here

Thank you for reviewing this work and the speedy feedback! I'll fix it
in v2.
}
+
+ 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