From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: devicetree@vger.kernel.org, m.chehab@osg.samsung.com
Cc: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com,
robh@kernel.org, hyun.kwon@xilinx.com,
soren.brinkmann@xilinx.com, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] of: Make return types of to_of_node and of_fwnode_handle macros consistent
Date: Thu, 2 Nov 2017 11:57:22 +0200 [thread overview]
Message-ID: <20171102095722.6893-1-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <2117711.dO2rQLXOup@avalon>
to_of_node() macro checks whether the fwnode_handle passed to it is not an
OF node, and if so, returns NULL in order to be NULL-safe. Otherwise it
returns the pointer to the OF node which the fwnode_handle contains.
The problem with returning NULL is that its type was void *, which
sometimes matters. Explicitly return struct device_node * instead.
Make a similar change to of_fwnode_handle() as well.
Fixes: d20dc1493db4 ("of: Support const and non-const use for to_of_node()")
Fixes: debd3a3b27c7 ("of: Make of_fwnode_handle() safer")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
Hi Mauro,
Could you check whether this addresses the smatch issue with the xilinx
driver?
Thanks.
include/linux/of.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/of.h b/include/linux/of.h
index b240ed69dc96..0651231c115e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -161,7 +161,7 @@ static inline bool is_of_node(const struct fwnode_handle *fwnode)
is_of_node(__to_of_node_fwnode) ? \
container_of(__to_of_node_fwnode, \
struct device_node, fwnode) : \
- NULL; \
+ (struct device_node *)NULL; \
})
#define of_fwnode_handle(node) \
@@ -169,7 +169,8 @@ static inline bool is_of_node(const struct fwnode_handle *fwnode)
typeof(node) __of_fwnode_handle_node = (node); \
\
__of_fwnode_handle_node ? \
- &__of_fwnode_handle_node->fwnode : NULL; \
+ &__of_fwnode_handle_node->fwnode : \
+ (struct fwnode_handle *)NULL; \
})
static inline bool of_have_populated_dt(void)
--
2.11.0
next prev parent reply other threads:[~2017-11-02 9:57 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-01 20:56 [PATCH v2 01/26] media: atmel-isc: avoid returning a random value at isc_parse_dt() Mauro Carvalho Chehab
2017-11-01 20:59 ` Mauro Carvalho Chehab
2017-11-01 21:03 ` Mauro Carvalho Chehab
2017-11-01 21:07 ` Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 02/26] media: dvb_frontend: be sure to init dvb_frontend_handle_ioctl() return code Mauro Carvalho Chehab
2017-11-07 18:29 ` Daniel Scheller
2017-11-01 21:05 ` [PATCH v2 03/26] media: led-class-flash: better handle NULL flash struct Mauro Carvalho Chehab
2017-11-02 9:08 ` Sakari Ailus
2017-11-01 21:05 ` [PATCH v2 04/26] media: tda8290: initialize agc gain Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 05/26] media: s5c73m3-core: fix logic on a timeout condition Mauro Carvalho Chehab
2017-11-02 7:12 ` Andrzej Hajda
2017-11-01 21:05 ` [PATCH v2 06/26] media: xc5000: better handle I2C error messages Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 07/26] media: radio-si476x: fix behavior when seek->range* are defined Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 08/26] media: v4l2-async: shut up an unitialized symbol warning Mauro Carvalho Chehab
2017-11-02 2:51 ` Laurent Pinchart
2017-11-02 8:49 ` Sakari Ailus
2017-12-11 18:10 ` Mauro Carvalho Chehab
2017-12-11 22:13 ` Laurent Pinchart
2017-12-14 12:12 ` Sakari Ailus
2017-11-01 21:05 ` [PATCH v2 09/26] media: cx25821-alsa: fix usage of a pointer printk Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 10/26] media: xc4000: don't ignore error if hwmodel fails Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 11/26] media: qt1010: fix bogus warnings Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 12/26] media: davinci: fix a debug printk Mauro Carvalho Chehab
2017-11-09 21:33 ` Lad, Prabhakar
2017-11-01 21:05 ` [PATCH v2 13/26] media: rcar: " Mauro Carvalho Chehab
2017-11-02 8:15 ` Niklas Söderlund
2017-11-01 21:05 ` [PATCH v2 14/26] media: xilinx: " Mauro Carvalho Chehab
2017-11-02 2:43 ` Laurent Pinchart
2017-11-02 9:20 ` Sakari Ailus
2017-11-02 9:57 ` Sakari Ailus [this message]
2017-11-02 9:59 ` [RESEND PATCH 1/1] of: Make return types of to_of_node and of_fwnode_handle macros consistent Sakari Ailus
2017-11-02 17:37 ` Laurent Pinchart
2017-11-06 21:45 ` Rob Herring
2017-11-01 21:05 ` [PATCH v2 15/26] media: pt1: fix logic when pt1_nr_tables is zero or negative Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 16/26] media: drxd_hard: better handle I2C errors Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 17/26] media: mxl111sf: improve error handling logic Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 18/26] media: dvbsky: shut up a bogus warning Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 19/26] media: ov9650: fix bogus warnings Mauro Carvalho Chehab
2017-11-02 10:06 ` Nicholas Mc Guire
2017-11-02 10:22 ` Nicholas Mc Guire
2017-11-01 21:05 ` [PATCH v2 20/26] media: imx274: don't randomly return if range_count is zero Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 21/26] media: m88rs2000: handle the case where tuner doesn't have get_frequency Mauro Carvalho Chehab
2017-11-01 21:05 ` [PATCH v2 22/26] [RFC] media: cxd2841er: ensure that status will always be available Mauro Carvalho Chehab
2017-11-01 21:06 ` [PATCH v2 23/26] media: drxj: better handle errors Mauro Carvalho Chehab
2017-11-01 21:06 ` [PATCH v2 24/26] media: stv090x: Only print tuner lock if get_status is available Mauro Carvalho Chehab
2017-11-01 21:06 ` [PATCH v2 25/26] media: mb86a16: be more resilient if I2C fails on sync Mauro Carvalho Chehab
2017-11-01 21:06 ` [PATCH v2 26/26] media: mb86a16: avoid division by zero Mauro Carvalho Chehab
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=20171102095722.6893-1-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=hyun.kwon@xilinx.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@osg.samsung.com \
--cc=robh@kernel.org \
--cc=soren.brinkmann@xilinx.com \
/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).