lkml.org 
[lkml]   [2014]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] of: Turn of_match_node into a static inline when CONFIG_OF isn't set
Date
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
>



\
 
 \ /
  Last update: 2014-02-17 19:41    [W:2.372 / U:0.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site