From 0d1270df836fe9f5cc7e8001b7372ca4fa3f00f6 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 7 Feb 2017 11:01:41 -0200 Subject: [media] zd1301: fix building interface driver without demodulator If the USB driver is enabled but the demodulator is not, we get a link error: ERROR: "zd1301_demod_get_dvb_frontend" [drivers/media/usb/dvb-usb-v2/zd1301.ko] undefined! ERROR: "zd1301_demod_get_i2c_adapter" [drivers/media/usb/dvb-usb-v2/zd1301.ko] undefined! Such a configuration obviously makes no sense, but we should not fail the build. This tries to mimic what we have for other drivers by turning the build failure into a runtime failure. Alternatively we could use an unconditional 'select' or 'depends on' to enforce a sane configuration. Fixes: 47d65372b3b6 ("[media] zd1301_demod: ZyDAS ZD1301 DVB-T demodulator driver") Fixes: 992b39872b80 ("[media] zd1301: ZyDAS ZD1301 DVB USB interface driver") Signed-off-by: Arnd Bergmann Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/dvb-usb-v2/zd1301.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/media/usb/dvb-usb-v2/zd1301.c') diff --git a/drivers/media/usb/dvb-usb-v2/zd1301.c b/drivers/media/usb/dvb-usb-v2/zd1301.c index 563e50c6a327..d1eb4b7bc051 100644 --- a/drivers/media/usb/dvb-usb-v2/zd1301.c +++ b/drivers/media/usb/dvb-usb-v2/zd1301.c @@ -168,6 +168,10 @@ static int zd1301_frontend_attach(struct dvb_usb_adapter *adap) adapter = zd1301_demod_get_i2c_adapter(pdev); frontend = zd1301_demod_get_dvb_frontend(pdev); + if (!adapter || !frontend) { + ret = -ENODEV; + goto err_module_put_demod; + } /* Add I2C tuner */ dev->mt2060_pdata.i2c_write_max = 9; -- cgit v1.2.1