netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Joakim Zhang <qiangqing.zhang@nxp.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, NXP Linux Team <linux-imx@nxp.com>,
	kernel@pengutronix.de
Subject: Re: [PATCH net-next RESEND] net: fec: Do proper error checking for enet_out clk
Date: Fri, 20 May 2022 22:20:14 +0200	[thread overview]
Message-ID: <Yof3/o46wXWXMsKo@lunn.ch> (raw)
In-Reply-To: <20220520062650.712561-1-u.kleine-koenig@pengutronix.de>

> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 11227f51404c..2512b68d8545 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -3866,9 +3866,11 @@ fec_probe(struct platform_device *pdev)
>  	fep->itr_clk_rate = clk_get_rate(fep->clk_ahb);
>  
>  	/* enet_out is optional, depends on board */
> -	fep->clk_enet_out = devm_clk_get(&pdev->dev, "enet_out");
> -	if (IS_ERR(fep->clk_enet_out))
> -		fep->clk_enet_out = NULL;
> +	fep->clk_enet_out = devm_clk_get_optional(&pdev->dev, "enet_out");
> +	if (IS_ERR(fep->clk_enet_out)) {
> +		ret = PTR_ERR(fep->clk_enet_out);
> +		goto failed_clk;
> +	}
>  
>  	fep->ptp_clk_on = false;
>  	mutex_init(&fep->ptp_clk_mutex);

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

This is O.K, as far as it goes. But directly after this we have:

	/* clk_ref is optional, depends on board */
	fep->clk_ref = devm_clk_get(&pdev->dev, "enet_clk_ref");
	if (IS_ERR(fep->clk_ref))
		fep->clk_ref = NULL;
	fep->clk_ref_rate = clk_get_rate(fep->clk_ref);

It would be good to do the same to this clock as well.

    Andrew

  reply	other threads:[~2022-05-20 20:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20  6:26 [PATCH net-next RESEND] net: fec: Do proper error checking for enet_out clk Uwe Kleine-König
2022-05-20 20:20 ` Andrew Lunn [this message]
2022-05-21  8:34   ` [PATCH v2] net: fec: Do proper error checking for optional clks Uwe Kleine-König
2022-05-21 14:26     ` Andrew Lunn
2022-05-22 20:50     ` patchwork-bot+netdevbpf
2022-05-22 21:00 ` [PATCH net-next RESEND] net: fec: Do proper error checking for enet_out clk patchwork-bot+netdevbpf

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=Yof3/o46wXWXMsKo@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=qiangqing.zhang@nxp.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).