]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: v4l2-fwnode: Avoid using PTR_ERR(NULL)
authorSakari Ailus <sakari.ailus@linux.intel.com>
Thu, 6 Jun 2019 14:18:42 +0000 (10:18 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Fri, 21 Jun 2019 21:54:00 +0000 (17:54 -0400)
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 <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-fwnode.c

index 44e9bcb6793594a6cdbac4e6dbcc6c2e86689a55..7e740d332a54e2c6371d6e12e611da86309af53c 100644 (file)
@@ -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);