[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150914074234.GC27591@x1>
Date: Mon, 14 Sep 2015 08:42:34 +0100
From: Lee Jones <lee.jones@...aro.org>
To: Fabio Estevam <festevam@...il.com>
Cc: "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
Pankaj Dev <pankaj.dev@...com>, linux-crypto@...r.kernel.org,
Matt Mackall <mpm@...enic.com>, kernel@...inux.com
Subject: Re: [PATCH 4/6] hwrng: st: Add support for ST's HW Random Number
Generator
On Sat, 12 Sep 2015, Fabio Estevam wrote:
> On Fri, Sep 11, 2015 at 5:08 PM, Lee Jones <lee.jones@...aro.org> wrote:
>
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + base = devm_ioremap_resource(&pdev->dev, res);
> > + if (IS_ERR(base))
> > + return PTR_ERR(base);
> > +
> > + clk = devm_clk_get(&pdev->dev, NULL);
> > + if (!clk)
> > + return -EINVAL;
>
> This should be:
>
> if (IS_ERR(clk))
> return PTR_ERR(clk);
You're right. Will fix.
> > +
> > + clk_prepare_enable(clk);
>
> This may fail, so better check its return value and propagate it on error.
Looks like the jury is out on this one.
$ git grep clk_prepare_enable | grep '= clk\|if (' | wc -l
659
$ git grep clk_prepare_enable | grep -v '= clk\|if (' | wc -l
569
... but it's not a problem to fix up. Will do.
> > + ddata->ops.priv = (unsigned long)ddata;
> > + ddata->ops.read = st_rng_read;
> > + ddata->ops.name = pdev->name;
> > + ddata->base = base;
> > + ddata->clk = clk;
> > +
> > + dev_set_drvdata(&pdev->dev, ddata);
> > +
> > + ret = hwrng_register(&ddata->ops);
> > + if (ret) {
> > + dev_err(&pdev->dev, "Failed to register HW RNG\n");
> > + return ret;
> > + }
> > +
> > + dev_info(&pdev->dev, "Successfully registered HW RNG\n");
>
> No need to put this info.
Ah, you caught me!
I know these types of prints are usually deemed not useful; however,
unless there is a failure both this driver and the core driver are
silent, so the user doesn't know that 1 or more of these devices are
available. I personally like to see an entry in the bootlog for this
kind of functionality.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists