* [PATCH] media: em28xx - add error handling for KWORLD dvb_attach failures
@ 2014-07-09 20:36 Shuah Khan
2014-07-12 20:19 ` Antti Palosaari
0 siblings, 1 reply; 2+ messages in thread
From: Shuah Khan @ 2014-07-09 20:36 UTC (permalink / raw)
To: m.chehab; +Cc: Shuah Khan, linux-media, linux-kernel
Add error hanlding when EM2870_BOARD_KWORLD_A340 dvb_attach()
for fe and tuner fail in em28xx_dvb_init().
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
drivers/media/usb/em28xx/em28xx-dvb.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index d381861..8314f51 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1213,9 +1213,17 @@ static int em28xx_dvb_init(struct em28xx *dev)
dvb->fe[0] = dvb_attach(lgdt3305_attach,
&em2870_lgdt3304_dev,
&dev->i2c_adap[dev->def_i2c_bus]);
- if (dvb->fe[0] != NULL)
- dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
- &dev->i2c_adap[dev->def_i2c_bus], &kworld_a340_config);
+ if (!dvb->fe[0]) {
+ result = -EINVAL;
+ goto out_free;
+ }
+ if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
+ &dev->i2c_adap[dev->def_i2c_bus],
+ &kworld_a340_config)) {
+ dvb_frontend_detach(dvb->fe[0]);
+ result = -EINVAL;
+ goto out_free;
+ }
break;
case EM28174_BOARD_PCTV_290E:
/* set default GPIO0 for LNA, used if GPIOLIB is undefined */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: em28xx - add error handling for KWORLD dvb_attach failures
2014-07-09 20:36 [PATCH] media: em28xx - add error handling for KWORLD dvb_attach failures Shuah Khan
@ 2014-07-12 20:19 ` Antti Palosaari
0 siblings, 0 replies; 2+ messages in thread
From: Antti Palosaari @ 2014-07-12 20:19 UTC (permalink / raw)
To: Shuah Khan, m.chehab; +Cc: linux-media, linux-kernel
Looks correct!
All the other devices, excluding those few PCTV ones I have added, has
that same bug... Deadlocks if tuner attach fails.
Reviewed-by: Antti Palosaari <crope@iki.fi>
regards
Antti
On 07/09/2014 11:36 PM, Shuah Khan wrote:
> Add error hanlding when EM2870_BOARD_KWORLD_A340 dvb_attach()
> for fe and tuner fail in em28xx_dvb_init().
>
> Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
> ---
> drivers/media/usb/em28xx/em28xx-dvb.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
> index d381861..8314f51 100644
> --- a/drivers/media/usb/em28xx/em28xx-dvb.c
> +++ b/drivers/media/usb/em28xx/em28xx-dvb.c
> @@ -1213,9 +1213,17 @@ static int em28xx_dvb_init(struct em28xx *dev)
> dvb->fe[0] = dvb_attach(lgdt3305_attach,
> &em2870_lgdt3304_dev,
> &dev->i2c_adap[dev->def_i2c_bus]);
> - if (dvb->fe[0] != NULL)
> - dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
> - &dev->i2c_adap[dev->def_i2c_bus], &kworld_a340_config);
> + if (!dvb->fe[0]) {
> + result = -EINVAL;
> + goto out_free;
> + }
> + if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
> + &dev->i2c_adap[dev->def_i2c_bus],
> + &kworld_a340_config)) {
> + dvb_frontend_detach(dvb->fe[0]);
> + result = -EINVAL;
> + goto out_free;
> + }
> break;
> case EM28174_BOARD_PCTV_290E:
> /* set default GPIO0 for LNA, used if GPIOLIB is undefined */
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-12 20:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-09 20:36 [PATCH] media: em28xx - add error handling for KWORLD dvb_attach failures Shuah Khan
2014-07-12 20:19 ` Antti Palosaari
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).