From: Suman Anna <s-anna@ti.com>
To: "Menon, Nishanth" <nm@ti.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Matt Mackall <mpm@selenic.com>,
Deepak Saxena <dsaxena@plexity.net>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Paul Walmsley <paul@pwsan.com>
Subject: Re: [PATCH] hwrng: OMAP: Fix assumption that runtime_get_sync will always succeed
Date: Fri, 24 Jun 2016 11:35:34 -0500 [thread overview]
Message-ID: <576D6156.2050508@ti.com> (raw)
In-Reply-To: <1466783867-25743-1-git-send-email-nm@ti.com>
Hi Nishanth,
On 06/24/2016 10:57 AM, Menon, Nishanth wrote:
> pm_runtime_get_sync does return a error value that must be checked for
> error conditions, else, due to various reasons, the device maynot be
> enabled and the system will crash due to lack of clock to the hardware
> module.
>
> Before:
> 12.562784] [00000000] *pgd=fe193835
> 12.562792] Internal error: : 1406 [#1] SMP ARM
> [...]
> 12.562864] CPU: 1 PID: 241 Comm: modprobe Not tainted 4.7.0-rc4-next-20160624 #2
> 12.562867] Hardware name: Generic DRA74X (Flattened Device Tree)
> 12.562872] task: ed51f140 ti: ed44c000 task.ti: ed44c000
> 12.562886] PC is at omap4_rng_init+0x20/0x84 [omap_rng]
> 12.562899] LR is at set_current_rng+0xc0/0x154 [rng_core]
> [...]
>
> After the proper checks:
> [ 94.366705] omap_rng 48090000.rng: _od_fail_runtime_resume: FIXME:
> missing hwmod/omap_dev info
> [ 94.375767] omap_rng 48090000.rng: Failed to runtime_get device -19
> [ 94.382351] omap_rng 48090000.rng: initialization failed.
>
> Fixes: 665d92fa85b5 ("hwrng: OMAP: convert to use runtime PM")
> Cc: Paul Walmsley <paul@pwsan.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>
> Patch based on: next-20160624
> Issue seen with next-20160624
> Full crash log: http://pastebin.ubuntu.com/17801376/
>
> drivers/char/hw_random/omap-rng.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
> index 8a1432e8bb80..f30a1870cb64 100644
> --- a/drivers/char/hw_random/omap-rng.c
> +++ b/drivers/char/hw_random/omap-rng.c
> @@ -384,7 +384,11 @@ static int omap_rng_probe(struct platform_device *pdev)
> }
>
> pm_runtime_enable(&pdev->dev);
> - pm_runtime_get_sync(&pdev->dev);
> + ret = pm_runtime_get_sync(&pdev->dev);
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret);
> + goto err_ioremap;
You need to also add a pm_runtime_put_noidle() on get_sync failures to
balance the device's power usage_count.
regards
Suman
> + }
>
> ret = (dev->of_node) ? of_get_omap_rng_device_details(priv, pdev) :
> get_omap_rng_device_details(priv);
> @@ -435,8 +439,14 @@ static int __maybe_unused omap_rng_suspend(struct device *dev)
> static int __maybe_unused omap_rng_resume(struct device *dev)
> {
> struct omap_rng_dev *priv = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = pm_runtime_get_sync(dev);
> + if (ret) {
> + dev_err(dev, "Failed to runtime_get device: %d\n", ret);
> + return ret;
> + }
>
> - pm_runtime_get_sync(dev);
> priv->pdata->init(priv);
>
> return 0;
>
next prev parent reply other threads:[~2016-06-24 16:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 15:57 [PATCH] hwrng: OMAP: Fix assumption that runtime_get_sync will always succeed Nishanth Menon
2016-06-24 16:35 ` Suman Anna [this message]
2016-06-24 16:46 ` Nishanth Menon
-- strict thread matches above, loose matches on Subject: below --
2016-06-24 16:50 [PATCH V2] " Nishanth Menon
2016-06-24 16:50 ` [PATCH] " Nishanth Menon
2016-06-24 16:54 ` Nishanth Menon
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=576D6156.2050508@ti.com \
--to=s-anna@ti.com \
--cc=dsaxena@plexity.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=nm@ti.com \
--cc=paul@pwsan.com \
/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