diff mbox series

media: cxd2880-spi: fix a reversed condition in error handling

Message ID 20210805104002.GC26417@kili
State New
Headers show
Series media: cxd2880-spi: fix a reversed condition in error handling | expand

Commit Message

Dan Carpenter Aug. 5, 2021, 10:40 a.m. UTC
This if statement is reversed so it leads to either a NULL dereference
or a leak.

Fixes: dcb014582101 ("media: cxd2880-spi: Fix an error handling path")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/media/spi/cxd2880-spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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 @@  cxd2880_spi_probe(struct spi_device *spi)
 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);