From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
Phil Edworthy <phil.edworthy@renesas.com>
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Simon Horman <horms@verge.net.au>,
linux-clk <linux-clk@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 1/2] clk: Add of_clk_get_by_name_optional() function
Date: Mon, 30 Jul 2018 13:57:07 +0300 [thread overview]
Message-ID: <c82487a125591c14e66ba56dc3202aa0093f0aba.camel@linux.intel.com> (raw)
In-Reply-To: <CAMuHMdUWWb7uyiG6NdRaJxM0X4JfioWx=o9J7jD18rgiTz1m4w@mail.gmail.com>
On Mon, 2018-07-30 at 10:55 +0200, Geert Uytterhoeven wrote:
> On Mon, Jul 30, 2018 at 10:36 AM Phil Edworthy
> <phil.edworthy@renesas.com> wrote:
> > +struct clk *of_clk_get_by_name_optional(struct device_node *np,
> > + const char *name)
> > +{
> > + if (!np)
> > + return ERR_PTR(-ENOENT);
>
> Shouldn't this return NULL?
> Or let __of_clk_get_by_name() handle that (cfr. above)?
>
> Hmm, of_clk_get_by_name() has a similar check, while the current
> __of_clk_get_by_name() already handle np == NULL, too.
This check is needed to prevent NULL pointer dereference below.
And I agree that absence of device node should be considered as okay
case for optional clock (!CONFIG_OF case, for example).
> > +
> > + return __of_clk_get_by_name(np, np->full_name, name, true);
> > +}
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2018-07-30 10:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 8:36 [PATCH v2 0/2] Add functions to get optional clocks Phil Edworthy
2018-07-30 8:36 ` [PATCH v2 1/2] clk: Add of_clk_get_by_name_optional() function Phil Edworthy
2018-07-30 8:55 ` Geert Uytterhoeven
2018-07-30 9:25 ` Phil Edworthy
2018-07-30 10:57 ` Andy Shevchenko [this message]
2018-07-30 11:29 ` Geert Uytterhoeven
2018-07-30 8:36 ` [PATCH v2 2/2] clk: Add functions to get optional clocks Phil Edworthy
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=c82487a125591c14e66ba56dc3202aa0093f0aba.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=geert@linux-m68k.org \
--cc=horms@verge.net.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mturquette@baylibre.com \
--cc=phil.edworthy@renesas.com \
--cc=sboyd@kernel.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