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: dcb0145821 ("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>
This commit is contained in:
Colin Ian King 2021-07-20 18:07:49 +02:00 committed by Mauro Carvalho Chehab
parent 8dcea1d608
commit 11b982e950

View File

@ -618,7 +618,7 @@ fail_frontend:
fail_attach: fail_attach:
dvb_unregister_adapter(&dvb_spi->adapter); dvb_unregister_adapter(&dvb_spi->adapter);
fail_adapter: fail_adapter:
if (!dvb_spi->vcc_supply) if (dvb_spi->vcc_supply)
regulator_disable(dvb_spi->vcc_supply); regulator_disable(dvb_spi->vcc_supply);
fail_regulator: fail_regulator:
kfree(dvb_spi); kfree(dvb_spi);