From: Ralf Baechle <ralf@linux-mips.org>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
linux-clk@vger.kernel.org,
Michael Turquette <mturquette@baylibre.com>,
linux-mips@linux-mips.org, linux-sh@vger.kernel.org,
Haojian Zhuang <haojian.zhuang@gmail.com>,
Eric Miao <eric.y.miao@gmail.com>,
Hartley Sweeten <hsweeten@visionengravers.com>,
Greg Ungerer <gerg@uclinux.org>, Ryan Mallon <rmallon@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Steven Miao <realmz6@gmail.com>,
Simon Horman <horms@verge.net.au>,
Wan ZongShun <mcuos.com@gmail.com>, Rich Felker <dalias@libc.org>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
adi-buildroot-devel@lists.sourceforge.net,
Russell King <linux@arm.linux.org.uk>,
linux-m68k@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vg
Subject: Re: [PATCH v2] clk: let clk_disable() return immediately if clk is NULL or error
Date: Fri, 8 Apr 2016 12:06:00 +0200 [thread overview]
Message-ID: <20160408100600.GI1668@linux-mips.org> (raw)
In-Reply-To: <20160408003328.GA14441@codeaurora.org>
On Thu, Apr 07, 2016 at 05:33:28PM -0700, Stephen Boyd wrote:
> On 04/05, Masahiro Yamada wrote:
> > The clk_disable() in the common clock framework (drivers/clk/clk.c)
> > returns immediately if a given clk is NULL or an error pointer. It
> > allows clock consumers to call clk_disable() without IS_ERR_OR_NULL
> > checking if drivers are only used with the common clock framework.
> >
> > Unfortunately, NULL/error checking is missing from some of non-common
> > clk_disable() implementations. This prevents us from completely
> > dropping NULL/error checking from callers. Let's make it tree-wide
> > consistent by adding IS_ERR_OR_NULL(clk) to all callees.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > Acked-by: Greg Ungerer <gerg@uclinux.org>
> > Acked-by: Wan Zongshun <mcuos.com@gmail.com>
> > ---
> >
> > Stephen,
> >
> > This patch has been unapplied for a long time.
> >
> > Please let me know if there is something wrong with this patch.
> >
>
> I'm mostly confused why we wouldn't want to encourage people to
> call clk_disable or unprepare on a clk that's an error pointer.
> Typically an error pointer should be dealt with, instead of
> silently ignored, so why wasn't it dealt with by passing it up
> the probe() path?
While your argument makes perfect sense, Many clk_disable implementations
are already doing similar checks, for example:
arch/arm/mach-davinci/clock.c:
void clk_disable(struct clk *clk)
{
unsigned long flags;
if (clk == NULL || IS_ERR(clk))
return;
[...]
arch/arm/mach-omap1/clock.c
void clk_disable(struct clk *clk)
{
unsigned long flags;
if (clk == NULL || IS_ERR(clk))
return;
[...]
arch/avr32/mach-at32ap/clock.c
void clk_disable(struct clk *clk)
{
unsigned long flags;
if (IS_ERR_OR_NULL(clk))
return;
[...]
arch/mips/lantiq/clk.c:
static inline int clk_good(struct clk *clk)
{
return clk && !IS_ERR(clk);
}
[...]
void clk_disable(struct clk *clk)
{
if (unlikely(!clk_good(clk)))
return;
if (clk->disable)
[...]
So should we go and weed out these checks?
Ralf
next parent reply other threads:[~2016-04-08 10:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1459821083-28116-1-git-send-email-yamada.masahiro@socionext.com>
[not found] ` <20160408003328.GA14441@codeaurora.org>
2016-04-08 10:06 ` Ralf Baechle [this message]
2016-04-08 11:15 ` [PATCH v2] clk: let clk_disable() return immediately if clk is NULL or error Masahiro Yamada
2016-04-14 0:40 ` 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=20160408100600.GI1668@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=adi-buildroot-devel@lists.sourceforge.net \
--cc=dalias@libc.org \
--cc=eric.y.miao@gmail.com \
--cc=geert@linux-m68k.org \
--cc=gerg@uclinux.org \
--cc=haojian.zhuang@gmail.com \
--cc=horms@verge.net.au \
--cc=hsweeten@visionengravers.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vg \
--cc=linux-m68k@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mcuos.com@gmail.com \
--cc=mturquette@baylibre.com \
--cc=realmz6@gmail.com \
--cc=rmallon@gmail.com \
--cc=sboyd@codeaurora.org \
--cc=yamada.masahiro@socionext.com \
--cc=ysato@users.sourceforge.jp \
/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).