From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] hwrng: st: Add support for ST's HW Random Number Generator
Date: Mon, 14 Sep 2015 08:42:34 +0100 [thread overview]
Message-ID: <20150914074234.GC27591@x1> (raw)
In-Reply-To: <CAOMZO5CWywFHd1HE2=G-KEvQZpu_rJibmJL4fL5yCWRsnpi05Q@mail.gmail.com>
On Sat, 12 Sep 2015, Fabio Estevam wrote:
> On Fri, Sep 11, 2015 at 5:08 PM, Lee Jones <lee.jones@linaro.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
next prev parent reply other threads:[~2015-09-14 7:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 20:08 [PATCH 0/6] hwrng: Add support for STMicroelectronics' RNG IP Lee Jones
2015-09-11 20:08 ` [PATCH 1/6] Documentation: hw_random: Fix device node name /dev/hw_random => /dev/hwrng Lee Jones
2015-09-14 14:57 ` Kieran Bingham
2015-09-11 20:08 ` [PATCH 2/6] hwrng: core: Simplify RNG switching from sysfs Lee Jones
2015-09-13 14:24 ` Peter Korsgaard
2015-09-14 7:27 ` Lee Jones
2015-09-11 20:08 ` [PATCH 3/6] hwrng: st: Provide DT bindings for ST's Random Number Generator Lee Jones
2015-09-11 20:08 ` [PATCH 4/6] hwrng: st: Add support for ST's HW " Lee Jones
2015-09-12 22:58 ` Kieran Bingham
2015-09-14 8:04 ` Lee Jones
2015-09-12 23:04 ` Fabio Estevam
2015-09-14 7:42 ` Lee Jones [this message]
2015-09-11 20:08 ` [PATCH 5/6] ARM: STi: STiH407: Enable the 2 HW Random Number Generators for STiH4{07, 10} Lee Jones
2015-09-11 20:08 ` [PATCH 6/6] MAINTAINERS: Add ST's Random Number Generator to the ST entry Lee Jones
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=20150914074234.GC27591@x1 \
--to=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).