aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/spi
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-07-20 18:07:49 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-09-30 10:07:40 +0200
commit11b982e950d2138e90bd120501df10a439006ff8 (patch)
tree0d0fe999feaa9367355f944e70da055c283e47b5 /drivers/media/spi
parentmedia: streamzap: ensure rx resolution can be retrieved (diff)
downloadlinux-dev-11b982e950d2138e90bd120501df10a439006ff8.tar.xz
linux-dev-11b982e950d2138e90bd120501df10a439006ff8.zip
media: cxd2880-spi: Fix a null pointer dereference on error handling path
Currently the null pointer check on dvb_spi->vcc_supply is inverted and this leads to only null values of the dvb_spi->vcc_supply being passed to the call of regulator_disable causing null pointer dereferences. Fix this by only calling regulator_disable if dvb_spi->vcc_supply is not null. Addresses-Coverity: ("Dereference after null check") Fixes: dcb014582101 ("media: cxd2880-spi: Fix an error handling path") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/spi')
-rw-r--r--drivers/media/spi/cxd2880-spi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c
index b91a1e845b97..506f52c1af10 100644
--- a/drivers/media/spi/cxd2880-spi.c
+++ b/drivers/media/spi/cxd2880-spi.c
@@ -618,7 +618,7 @@ fail_frontend:
fail_attach:
dvb_unregister_adapter(&dvb_spi->adapter);
fail_adapter:
- if (!dvb_spi->vcc_supply)
+ if (dvb_spi->vcc_supply)
regulator_disable(dvb_spi->vcc_supply);
fail_regulator:
kfree(dvb_spi);