Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3863360c authored by Wei Yongjun's avatar Wei Yongjun Committed by Mauro Carvalho Chehab
Browse files

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: default avatarWei Yongjun <weiyongjun1@huawei.com>
Acked-by: default avatarHelen Koike <helen.koike@collabora.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 5232c37c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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,