linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/7] ARM: OMAP2+: Fix error handling for omap2_clk_enable_init_clocks
Date: Wed, 14 Jan 2015 09:27:36 -0800	[thread overview]
Message-ID: <20150114172736.GN2419@atomide.com> (raw)
In-Reply-To: <20150114012148.GE18523@saruman>

* Felipe Balbi <balbi@ti.com> [150113 17:25]:
> On Tue, Jan 13, 2015 at 03:13:52PM -0800, Tony Lindgren wrote:
> > We need to check if we got the clock before trying to do anything
> > with it. Otherwise we will get something like this:
> > 
> > Unable to handle kernel paging request at virtual address fffffffe
> > ...
> > [<c04bef78>] (clk_prepare) from [<c00338a4>] (omap2_clk_enable_init_clocks+0x50/0x8)
> > [<c00338a4>] (omap2_clk_enable_init_clocks) from [<c0876838>] (dm816x_dt_clk_init+0)
> > ...
> > 
> > Let's add check for the clock and WARN if the init clock was not
> > found.
> > 
> > Cc: Brian Hutchinson <b.hutchman@gmail.com>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Just one minor nit below, other than that:
> 
> Reviewed-by: Felipe Balbi <balbi@ti.com>
> 
> > ---
> >  arch/arm/mach-omap2/clock.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
> > index 6ad5b4d..89a0732 100644
> > --- a/arch/arm/mach-omap2/clock.c
> > +++ b/arch/arm/mach-omap2/clock.c
> > @@ -620,6 +620,11 @@ void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
> >  
> >  	for (i = 0; i < num_clocks; i++) {
> >  		init_clk = clk_get(NULL, clk_names[i]);
> > +		if (IS_ERR(init_clk)) {
> > +			WARN(1, "omap clock: could not find init clock %s\n",
> > +			     clk_names[i]);
> 
> you can combine the if with the WARN():
> 
> 		if (WARN(IS_ERR(init_clk), "could not find init clock %s\n",
> 			clk_names[i]))
> 
> not that I also removed that "omap clock" prefix because WARN() will
> print the file name anyway.
> 
> > +			continue;
> > +		}
> >  		clk_prepare_enable(init_clk);
> >  	}
> >  }

Sure makes sense to me. Updated patch below.

Regards,

Tony

8< -------------
From: Tony Lindgren <tony@atomide.com>
Date: Mon, 22 Dec 2014 08:19:07 -0800
Subject: [PATCH] ARM: OMAP2+: Fix error handling for omap2_clk_enable_init_clocks

We need to check if we got the clock before trying to do anything
with it. Otherwise we will get something like this:

Unable to handle kernel paging request at virtual address fffffffe
...
[<c04bef78>] (clk_prepare) from [<c00338a4>] (omap2_clk_enable_init_clocks+0x50/0x8)
[<c00338a4>] (omap2_clk_enable_init_clocks) from [<c0876838>] (dm816x_dt_clk_init+0)
...

Let's add check for the clock and WARN if the init clock was not
found.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>

--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -620,6 +620,9 @@ void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
 
 	for (i = 0; i < num_clocks; i++) {
 		init_clk = clk_get(NULL, clk_names[i]);
+		if (WARN(IS_ERR(init_clk), "could not find init clock %s\n",
+				clk_names[i]))
+			continue;
 		clk_prepare_enable(init_clk);
 	}
 }

  reply	other threads:[~2015-01-14 17:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 23:13 [PATCH 0/7] Fixes and clean-up in preparation for booting ti81xx Tony Lindgren
2015-01-13 23:13 ` [PATCH 1/7] ARM: OMAP2+: Remove unused ti81xx platform init code Tony Lindgren
2015-01-14  1:19   ` Felipe Balbi
2015-01-14 17:19     ` Tony Lindgren
2015-01-13 23:13 ` [PATCH 2/7] ARM: OMAP2+: Fix error handling for omap2_clk_enable_init_clocks Tony Lindgren
2015-01-14  1:21   ` Felipe Balbi
2015-01-14 17:27     ` Tony Lindgren [this message]
2015-01-13 23:13 ` [PATCH 3/7] ARM: OMAP2+: Fix ti81xx devtype Tony Lindgren
2015-01-13 23:13 ` [PATCH 4/7] ARM: OMAP2+: Fix ti81xx class type Tony Lindgren
2015-01-13 23:13 ` [PATCH 5/7] ARM: OMAP2+: Fix dm814 and dm816 for clocks and timer init Tony Lindgren
2015-01-13 23:13 ` [PATCH 6/7] ARM: OMAP2+: Fix reboot for 81xx Tony Lindgren
2015-01-14  1:24   ` Felipe Balbi
2015-01-14 19:04     ` Tony Lindgren
2015-01-14 19:30       ` Felipe Balbi
2015-01-13 23:13 ` [PATCH 7/7] ARM: OMAP2+: Disable omap3 PM init for ti81xx Tony Lindgren

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=20150114172736.GN2419@atomide.com \
    --to=tony@atomide.com \
    --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).