Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280433

Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices
Date 2015-12-01 01:50 +0100
Message-ID <qAHiN-2re-1@gated-at.bofh.it> (permalink)
References (1 earlier) <qwOsx-4aA-1@gated-at.bofh.it> <qwXYR-1UO-5@gated-at.bofh.it> <qxw0x-8at-3@gated-at.bofh.it> <qya7E-Sp-7@gated-at.bofh.it> <qAsa7-1cU-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-11-20 08:40 +0100
  Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid  clock-indices Stephen Boyd <sboyd@codeaurora.org> - 2015-11-20 18:50 +0100
    Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-11-22 07:10 +0100
      Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid  clock-indices Stephen Boyd <sboyd@codeaurora.org> - 2015-11-24 02:00 +0100
        Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices Masahiro Yamada <yamada.masahiro@socionext.com> - 2015-11-30 09:40 +0100
          Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid  clock-indices Stephen Boyd <sboyd@codeaurora.org> - 2015-12-01 01:50 +0100

csiph-web