mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: han.junyang@zte.com.cn
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	ran.ming@zte.com.cn, han.chengfei@zte.com.cn,
	zhang.yanze@zte.com.cn
Subject: Re: [PATCH net-next v5 1/2] dinghai: add ZTE network driver support
Date: Mon, 1 Jun 2026 16:21:38 +0200	[thread overview]
Message-ID: <2f211c43-575a-4661-b37a-6fe61d24da79@lunn.ch> (raw)
In-Reply-To: <20260601143002051rSxzNiN9iKNj5gsdema0a@zte.com.cn>

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

  reply	other threads:[~2026-06-01 14:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  6:24 [PATCH net-next v5 0/2] Add ZTE DingHai Ethernet PF driver han.junyang
2026-06-01  6:30 ` [PATCH net-next v5 1/2] dinghai: add ZTE network driver support han.junyang
2026-06-01 14:21   ` Andrew Lunn [this message]
2026-06-01 14:28   ` Andrew Lunn
2026-06-01  6:34 ` [PATCH net-next v5 2/2] dinghai: add hardware register access and PCI capability scanning han.junyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f211c43-575a-4661-b37a-6fe61d24da79@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=han.chengfei@zte.com.cn \
    --cc=han.junyang@zte.com.cn \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ran.ming@zte.com.cn \
    --cc=zhang.yanze@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®