media: cxd2880-spi: fix probe when dvb_attach fails
authorNeil Armstrong <narmstrong@baylibre.com>
Thu, 8 Nov 2018 12:44:48 +0000 (07:44 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 3 Dec 2018 18:26:48 +0000 (13:26 -0500)
When dvb_attach fails, probe returns 0, and remove crashes afterwards.
This patch sets the return value to -ENODEV when attach fails.

Fixes: bd24fcddf6b8 ("media: cxd2880-spi: Add support for CXD2880 SPI interface")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/spi/cxd2880-spi.c

index 11ce5101e19f6b71ed703ea9cd8010e7ae1b6967..c43730977f53c0bd7caa28fa58a1ce67018ce082 100644 (file)
@@ -536,6 +536,7 @@ cxd2880_spi_probe(struct spi_device *spi)
 
        if (!dvb_attach(cxd2880_attach, &dvb_spi->dvb_fe, &config)) {
                pr_err("cxd2880_attach failed\n");
+               ret = -ENODEV;
                goto fail_attach;
        }