aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vimc/vimc-core.c
diff options
context:
space:
mode:
authorWei Yongjun <[email protected]>2017-10-11 11:16:43 +0000
committerMauro Carvalho Chehab <[email protected]>2017-10-27 12:00:11 +0000
commit3863360c15da47e18d894268ad6182fdc7caf0c7 (patch)
treeede9cbeb0c4c6a0b718426cd1aa4748eb6af8975 /drivers/media/platform/vimc/vimc-core.c
parentmedia: venus: venc: fix bytesused v4l2_plane field (diff)
downloadkernel-3863360c15da47e18d894268ad6182fdc7caf0c7.tar.gz
kernel-3863360c15da47e18d894268ad6182fdc7caf0c7.zip
media: vimc: Fix return value check in vimc_add_subdevs()
In case of error, the function platform_device_register_data() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun <[email protected]> Acked-by: Helen Koike <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Diffstat (limited to 'drivers/media/platform/vimc/vimc-core.c')
-rw-r--r--drivers/media/platform/vimc/vimc-core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c
index 51c0eee61ca6..fe088a953860 100644
--- a/drivers/media/platform/vimc/vimc-core.c
+++ b/drivers/media/platform/vimc/vimc-core.c
@@ -267,11 +267,12 @@ static struct component_match *vimc_add_subdevs(struct vimc_device *vimc)
PLATFORM_DEVID_AUTO,
&pdata,
sizeof(pdata));
- if (!vimc->subdevs[i]) {
+ if (IS_ERR(vimc->subdevs[i])) {
+ match = ERR_CAST(vimc->subdevs[i]);
while (--i >= 0)
platform_device_unregister(vimc->subdevs[i]);
- return ERR_PTR(-ENOMEM);
+ return match;
}
component_match_add(&vimc->pdev.dev, &match, vimc_comp_compare,