All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: return proper ERR_PTR for clk_get when !HAVE_CLK
Date: Sat, 7 Feb 2015 17:42:09 +0100	[thread overview]
Message-ID: <20150207164209.GA6263@katana> (raw)
In-Reply-To: <20150205234040.GV8656@n2100.arm.linux.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

On Thu, Feb 05, 2015 at 11:40:40PM +0000, Russell King - ARM Linux wrote:
> On Thu, Feb 05, 2015 at 08:09:22PM +0100, Wolfram Sang wrote:
> > clk_get functions return an ERR_PTR and not NULL in the error case. Make
> > that consistent for the dummy functions when HAVE_CLK is not enabled.
> > Otherwise unexpected codepaths might be trying to use a NULL pointer.
> 
> NAK.
> 
> There are some drivers which rely on this behaviour (take a driver,
> such as some PXA IP) which uses the clk API but is also reused on
> x86 which doesn't.

Okay, thanks for the explanation. Let me recap, there are three cases
that clk_get can return:

a) pointer to a clk
b) ERR_PTR meaning something went wrong when trying to get a clk
c) NULL meaning there is no clk to get

So, if this patch from i2c/for-next [1] wants to add optional clk
support, it should fallback to the old handling not by checking for
(!IS_ERR()) but for (!IS_ERR_OR_NULL()).

Correct?

[1] https://git.kernel.org/cgit/linux/kernel/git/wsa/linux.git/commit/?h=i2c/for-next&id=e961a094afe04c6c8ca1adac50c8d16513f31b93


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-02-07 16:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05 19:09 [PATCH] clk: return proper ERR_PTR for clk_get when !HAVE_CLK Wolfram Sang
2015-02-05 23:40 ` Russell King - ARM Linux
2015-02-07 16:42   ` Wolfram Sang [this message]
2015-02-07 17:29     ` Russell King - ARM Linux
2015-02-09 14:29       ` Wolfram Sang
2015-02-10 11:02         ` Russell King - ARM Linux
2015-02-19 16:20           ` Wolfram Sang

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=20150207164209.GA6263@katana \
    --to=wsa@the-dreams.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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.