media: cxd2880-spi: Fix a null pointer dereference on error handling path
authorColin Ian King <colin.king@canonical.com>
Tue, 20 Jul 2021 16:07:49 +0000 (18:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:27 +0000 (19:16 +0100)
commitf8b2ae89671d42483ec880acdf2a7d3b607bd31e
tree4f171bea24c8d5cc45819e6ab355d263a6477f54
parentb6100e16716e69eba4191fb0af157cff74d7a806
media: cxd2880-spi: Fix a null pointer dereference on error handling path

[ Upstream commit 11b982e950d2138e90bd120501df10a439006ff8 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/spi/cxd2880-spi.c