From: <Claudiu.Beznea@microchip.com>
To: <harini.katakam@xilinx.com>, <Nicolas.Ferre@microchip.com>,
<davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<michal.simek@xilinx.com>, <harinikatakamlinux@gmail.com>
Subject: Re: [RFC PATCH] net: macb: Add null check for PCLK and HCLK
Date: Tue, 19 Mar 2019 16:21:43 +0000 [thread overview]
Message-ID: <74d29e0e-d55e-e983-add1-361f7c4af948@microchip.com> (raw)
In-Reply-To: <1552974845-1590-1-git-send-email-harini.katakam@xilinx.com>
On 19.03.2019 07:54, Harini Katakam wrote:
> Both PCLK and HCLK are "required" clocks according to macb devicetree
> documentation. There is a chance that devm_clk_get doesn't return a
> negative error but just a NULL clock structure instead. In such a case
> the driver proceeds as usual and uses pclk value 0 to calculate MDC
> divisor which is incorrect. Hence fix the same in clock initialization.
>
> Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
> ---
> drivers/net/ethernet/cadence/macb_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index ad099fd..d12d815 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -3370,13 +3370,13 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
> *hclk = devm_clk_get(&pdev->dev, "hclk");
> }
>
> - if (IS_ERR(*pclk)) {
> + if (IS_ERR(*pclk) || (*pclk == NULL)) {
You can use IS_ERR_OR_NULL() macro.
> err = PTR_ERR(*pclk);
> dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
> return err;
> }
>
> - if (IS_ERR(*hclk)) {
> + if (IS_ERR(*hclk) || (*hclk == NULL)) {
Ditto
> err = PTR_ERR(*hclk);
> dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
> return err;
>
next prev parent reply other threads:[~2019-03-19 16:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 5:54 Harini Katakam
2019-03-19 16:21 ` Claudiu.Beznea [this message]
2019-03-20 10:46 ` Harini Katakam
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=74d29e0e-d55e-e983-add1-361f7c4af948@microchip.com \
--to=claudiu.beznea@microchip.com \
--cc=Nicolas.Ferre@microchip.com \
--cc=davem@davemloft.net \
--cc=harini.katakam@xilinx.com \
--cc=harinikatakamlinux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=netdev@vger.kernel.org \
/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®