[media] em28xx: do not set PCTV 290e LNA handler if fe attach fail
authorAntti Palosaari <crope@iki.fi>
Wed, 19 Sep 2012 23:52:21 +0000 (20:52 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 1 Oct 2012 20:07:06 +0000 (17:07 -0300)
It was a bug that could cause oops if demodulator attach was
failed.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/em28xx/em28xx-dvb.c

index 0ca3e05992bf7f021af9a7d8fabf12b0e838b82b..1662b70435b3aac231d7e6aeab8cbbd1b2aa8a50 100644 (file)
@@ -1002,20 +1002,22 @@ static int em28xx_dvb_init(struct em28xx *dev)
                                result = -EINVAL;
                                goto out_free;
                        }
-               }
 
 #ifdef CONFIG_GPIOLIB
-               /* enable LNA for DVB-T, DVB-T2 and DVB-C */
-               result = gpio_request_one(dvb->lna_gpio, GPIOF_OUT_INIT_LOW,
-                               NULL);
-               if (result)
-                       em28xx_errdev("gpio request failed %d\n", result);
-               else
-                       gpio_free(dvb->lna_gpio);
-
-               result = 0; /* continue even set LNA fails */
+                       /* enable LNA for DVB-T, DVB-T2 and DVB-C */
+                       result = gpio_request_one(dvb->lna_gpio,
+                                       GPIOF_OUT_INIT_LOW, NULL);
+                       if (result)
+                               em28xx_errdev("gpio request failed %d\n",
+                                               result);
+                       else
+                               gpio_free(dvb->lna_gpio);
+
+                       result = 0; /* continue even set LNA fails */
 #endif
-               dvb->fe[0]->ops.set_lna = em28xx_pctv_290e_set_lna;
+                       dvb->fe[0]->ops.set_lna = em28xx_pctv_290e_set_lna;
+               }
+
                break;
        case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
        {