Re: [PATCH net-next v5 1/2] dinghai: add ZTE network driver support

From: Andrew Lunn

Date: Mon Jun 01 2026 - 10:28:57 EST


> +static int dh_pf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> +{
> + struct zxdh_pf_device *pf_dev;
> + struct dh_core_dev *dh_dev;
> + struct devlink *devlink;
> + int ret;
> +
> + dev_info(&pdev->dev, "dh_pf probe start\n");

Please don't spam the kernel log.

> + ret = dh_pf_pci_init(dh_dev);
> + if (ret) {
> + dev_err(&pdev->dev, "dh_pf_pci_init failed: %d\n", ret);
> + goto err_cfg_init;
> + }
> +
> + dev_info(&pdev->dev, "dh_pf probe completed\n");
> +
> + return 0;
> +
> +err_cfg_init:
> + mutex_destroy(&pf_dev->irq_lock);
> + mutex_destroy(&dh_dev->lock);
> + dh_core_free_priv(dh_dev);
> +err_pf_dev:
> + devlink_free(devlink);
> + return -ENOMEM;

dh_pf_pci_init() returns an error code. You should use it here. It
makes the code hard to debug when the higher level is ENOMEM, but the
lower is saying EINVAL or something.

> +static void dh_pf_remove(struct pci_dev *pdev)
> +{
> + struct dh_core_dev *dh_dev = pci_get_drvdata(pdev);
> + struct devlink *devlink = priv_to_devlink(dh_dev);
> + struct zxdh_pf_device *pf_dev = dh_dev->priv;
> +
> + dev_info(&pdev->dev, "dh_pf remove start\n");

More log spamming. Drivers mostly use dev_err() for when things have
gone wrong, and dev_dbg() for debug. Other levels exists, but they are
not really used. If you do use them, they need to be for good reasons.

Andrew