diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2017-10-11 07:16:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2017-10-27 08:00:11 -0400 |
commit | 3863360c15da47e18d894268ad6182fdc7caf0c7 (patch) | |
tree | ede9cbeb0c4c6a0b718426cd1aa4748eb6af8975 /drivers/media/platform/vimc | |
parent | 5232c37ce244db04fd50d160b92e40d2df46a2e9 (diff) |
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 <weiyongjun1@huawei.com>
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/vimc')
-rw-r--r-- | drivers/media/platform/vimc/vimc-core.c | 5 |
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) | |||
267 | PLATFORM_DEVID_AUTO, | 267 | PLATFORM_DEVID_AUTO, |
268 | &pdata, | 268 | &pdata, |
269 | sizeof(pdata)); | 269 | sizeof(pdata)); |
270 | if (!vimc->subdevs[i]) { | 270 | if (IS_ERR(vimc->subdevs[i])) { |
271 | match = ERR_CAST(vimc->subdevs[i]); | ||
271 | while (--i >= 0) | 272 | while (--i >= 0) |
272 | platform_device_unregister(vimc->subdevs[i]); | 273 | platform_device_unregister(vimc->subdevs[i]); |
273 | 274 | ||
274 | return ERR_PTR(-ENOMEM); | 275 | return match; |
275 | } | 276 | } |
276 | 277 | ||
277 | component_match_add(&vimc->pdev.dev, &match, vimc_comp_compare, | 278 | component_match_add(&vimc->pdev.dev, &match, vimc_comp_compare, |