From: Grant Likely <grant.likely@linaro.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-kernel@vger.kernel.org
Cc: devicetree@vger.kernel.org, Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH] of: Turn of_match_node into a static inline when CONFIG_OF isn't set
Date: Mon, 17 Feb 2014 18:18:29 +0000 [thread overview]
Message-ID: <20140217181829.B5F80C40372@trevor.secretlab.ca> (raw)
In-Reply-To: <1392122211-11422-1-git-send-email-laurent.pinchart@ideasonboard.com>
On Tue, 11 Feb 2014 13:36:51 +0100, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote:
> when CONFIG_OF is disabled of_match_node is defined as a macro that
> evaluates to NULL. This breaks compilation of drivers that dereference
> the function's return value directly. Fix it by turning the macro into a
> static inline function that returns NULL.
Is it not more problematic that code is dereferencing the return value
directly *without* checking to see if it is NULL first? I suppose it
will cause a runtime oops on all platforms except no-mmu, but still.
Compile time catches are better.
g.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> include/linux/of.h | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 70c64ba..719e69f 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -560,7 +560,13 @@ static inline const char *of_prop_next_string(struct property *prop,
> }
>
> #define of_match_ptr(_ptr) NULL
> -#define of_match_node(_matches, _node) NULL
> +
> +static inline const struct of_device_id *of_match_node(
> + const struct of_device_id *matches, const struct device_node *node)
> +{
> + return NULL;
> +}
> +
> #endif /* CONFIG_OF */
>
> #if defined(CONFIG_OF) && defined(CONFIG_NUMA)
> --
> Regards,
>
> Laurent Pinchart
>
next prev parent reply other threads:[~2014-02-17 18:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1392122211-11422-1-git-send-email-laurent.pinchart@ ideasonboard.com>
2014-02-11 12:36 ` Laurent Pinchart
2014-02-11 14:41 ` Josh Cartwright
2014-02-11 14:55 ` Laurent Pinchart
2014-02-11 16:48 ` Josh Cartwright
2014-02-11 17:20 ` Laurent Pinchart
2014-02-11 18:08 ` Josh Cartwright
2014-02-11 18:29 ` Geert Uytterhoeven
2014-02-11 20:06 ` Arnd Bergmann
2014-02-12 21:54 ` Geert Uytterhoeven
2014-02-13 1:01 ` Josh Cartwright
2014-02-11 21:30 ` Rob Herring
2014-02-11 21:55 ` Josh Cartwright
2014-02-11 23:14 ` Rob Herring
2014-02-12 2:15 ` Josh Cartwright
2014-02-11 19:17 ` Laurent Pinchart
2014-02-17 18:19 ` Grant Likely
2014-02-17 18:18 ` Grant Likely [this message]
2014-02-17 19:50 ` Laurent Pinchart
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=20140217181829.B5F80C40372@trevor.secretlab.ca \
--to=grant.likely@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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
all inboxes | Powered by JetHome®