media: staging/imx: remove confusing IS_ERR_OR_NULL usage
authorArnd Bergmann <arnd@arndb.de>
Tue, 11 Jul 2017 13:18:35 +0000 (09:18 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 8 Aug 2017 10:48:58 +0000 (06:48 -0400)
commit0b2e9e7947e7bfd08c512e15ae02645cf9cd38c5
tree37962095290331e18b3dd37721eadc03f96682d9
parent05ad2b6dbbb03031a7761e6607a152deafbc39e9
media: staging/imx: remove confusing IS_ERR_OR_NULL usage

While looking at a compiler warning, I noticed the use of
IS_ERR_OR_NULL, which is generally a sign of a bad API design
and should be avoided.

In this driver, this is fairly easy, we can simply stop storing
error pointers in persistent structures, and change the two
functions that might return either a NULL pointer or an error
code to consistently return error pointers when failing.

of_parse_subdev() now separates the error code and the pointer
it looks up, to clarify the interface. There are two cases
where this function originally returns 'NULL', and I have
changed that to '0' for success to keep the current behavior,
though returning an error would also make sense there.

Fixes: e130291212df ("[media] media: Add i.MX media core driver")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/staging/media/imx/imx-ic-prpencvf.c
drivers/staging/media/imx/imx-media-csi.c
drivers/staging/media/imx/imx-media-dev.c
drivers/staging/media/imx/imx-media-of.c
drivers/staging/media/imx/imx-media-vdic.c