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

Willem de Bruijn
2020-10-08T12:23:26Z

On Thu, Oct 8, 2020 at 7:58 AM Coiby Xu <coiby.xu@gmail.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@gmail.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.

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

and here

> }
> +
> + 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;
> }