From: Sakari Ailus Date: Thu, 6 Jun 2019 14:18:42 +0000 (-0400) Subject: media: v4l2-fwnode: Avoid using PTR_ERR(NULL) X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=4ace2d28aba594e234923f55f476e97c56f6689a;p=openwrt%2Fstaging%2Fblogic.git media: v4l2-fwnode: Avoid using PTR_ERR(NULL) PTR_ERR(NULL) yields 0 which is commonly used to denote success. This is the case here, and PTR_ERR(NULL) is apparently shunned upon. Fix this by explicitly returning 0 if fwnode == NULL. Reported-by: Hans Verkuil Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 44e9bcb67935..7e740d332a54 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -1095,7 +1095,7 @@ v4l2_fwnode_reference_parse_int_props(struct device *dev, } } - return PTR_ERR(fwnode) == -ENOENT ? 0 : PTR_ERR(fwnode); + return !fwnode || PTR_ERR(fwnode) == -ENOENT ? 0 : PTR_ERR(fwnode); error: fwnode_handle_put(fwnode);