All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-clk@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ben Dooks <ben.dooks@codethink.co.uk>
Subject: Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices
Date: Mon, 30 Nov 2015 16:44:46 -0800	[thread overview]
Message-ID: <20151201004446.GC17532@codeaurora.org> (raw)
In-Reply-To: <CAK7LNASVzPndasdNE+EX1pB_VmDp_OjBYv2D1FKqL8JbCFkCuA@mail.gmail.com>

On 11/30, Masahiro Yamada wrote:
> Hi Stephen,
> 
> 
> 
> >>
> >> Of course we can, although we have to mention "clock-indices" twice.
> >>
> >> A good thing for of_get_property() is that we can get both the value
> >> and the length
> >> at the same time.
> >>
> >
> > Ok. Well if we don't want to count them again, perhaps a goto
> > jump over an unconditional return NULL would be better?
> >
> >         of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) {
> >                 if (index == pv) {
> >                         index = count;
> >                         goto found;
> >                 }
> >                 count++;
> >         }
> >
> >         return NULL;
> > found:
> >
> > Or since the macro for of_property_for_each_u32() tests the vp
> > poitner for NULL, we can check that pointer too...
> >
> >         of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) {
> >                 if (index == pv) {
> >                         index = count;
> >                         break;
> >                 }
> >                 count++;
> >         }
> >
> >         /* We didn't find anything */
> >         if (!vp)
> >                 return NULL;
> >
> > I guess I prefer the latter approach here.
> >
> 
> No.
> 
> Neither of your two suggestions works because they are false positive.
> 

So if (!vp && count) then?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2015-12-01  0:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-20  7:36 [PATCH 1/3] clk: remove redundant negative index check in of_clk_get_parent_name() Masahiro Yamada
2015-11-20  7:36 ` [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices Masahiro Yamada
2015-11-20 17:45   ` Stephen Boyd
2015-11-22  6:03     ` Masahiro Yamada
2015-11-24  0:53       ` Stephen Boyd
2015-11-30  8:34         ` Masahiro Yamada
2015-12-01  0:44           ` Stephen Boyd [this message]
2015-11-20  7:36 ` [PATCH 3/3] clk: split of_clk_get_parent_name() into two functions Masahiro Yamada
2015-11-21  0:37   ` Stephen Boyd
2015-11-22  5:44     ` Masahiro Yamada
2015-11-24  4:25       ` Masahiro Yamada
2015-12-01  0:49         ` Stephen Boyd
2015-12-01  1:51           ` Masahiro Yamada
2015-11-20 17:18 ` [PATCH 1/3] clk: remove redundant negative index check in of_clk_get_parent_name() Stephen Boyd

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=20151201004446.GC17532@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=ben.dooks@codethink.co.uk \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=yamada.masahiro@socionext.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.