diff mbox

Question about 2 gp8psk patches I noticed, and possible bug.

Message ID 20161111104903.607428e5@vela.lan (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab Nov. 11, 2016, 12:49 p.m. UTC
Em Thu, 10 Nov 2016 07:01:44 -0800
VDR User <user.vdr@gmail.com> escreveu:

> > commit 0c979a12309af49894bb1dc60e747c3cd53fa888
> > Author: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> > Date:   Wed Nov 9 15:33:17 2016 -0200
> >
> >     [media] gp8psk: Fix DVB frontend attach
> >
> >     it should be calling module_get() at attach, as otherwise
> >     module_put() will crash.
> >
> >     Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> >
> > diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c
> > index cede0d8b0f8a..24eb6c6c8e24 100644
> > --- a/drivers/media/usb/dvb-usb/gp8psk.c
> > +++ b/drivers/media/usb/dvb-usb/gp8psk.c
> > @@ -250,7 +250,7 @@ static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
> >
> >  static int gp8psk_frontend_attach(struct dvb_usb_adapter *adap)
> >  {
> > -       adap->fe_adap[0].fe = gp8psk_fe_attach(adap->dev);
> > +       adap->fe_adap[0].fe = dvb_attach(gp8psk_fe_attach, adap->dev);
> >         return 0;
> >  }  
> 
> This gives:
> 
> [119150.498863] DVB: Unable to find symbol gp8psk_fe_attach()
> [119150.498928] dvb-usb: no frontend was attached by 'Genpix
> SkyWalker-2 DVB-S receiver'

Hmm... dvb_attach() assumes that the symbol is exported. Please try
this patch. If it fixes the bug, I'll likely do something else, to
avoid the need of EXPORT_SYMBOL.


[PATCH] [media] gp8psk: Fix DVB frontend attach

it should be calling module_get() at attach, as otherwise
module_put() will crash.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>






Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

VDRU VDRU Nov. 11, 2016, 3:33 p.m. UTC | #1
> Hmm... dvb_attach() assumes that the symbol is exported. Please try
> this patch. If it fixes the bug, I'll likely do something else, to
> avoid the need of EXPORT_SYMBOL.
>
>
> [PATCH] [media] gp8psk: Fix DVB frontend attach
>
> it should be calling module_get() at attach, as otherwise
> module_put() will crash.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
>
> diff --git a/drivers/media/usb/dvb-usb/gp8psk-fe.c b/drivers/media/usb/dvb-usb/gp8psk-fe.c
> index db6eb79cde07..ab7c6093436b 100644
> --- a/drivers/media/usb/dvb-usb/gp8psk-fe.c
> +++ b/drivers/media/usb/dvb-usb/gp8psk-fe.c
> @@ -326,6 +326,7 @@ struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d)
>  success:
>         return &s->fe;
>  }
> +EXPORT_SYMBOL_GPL(gp8psk_fe_attach);
>
>
>  static struct dvb_frontend_ops gp8psk_fe_ops = {
> diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c
> index 2829e3082d15..c3762c50e93b 100644
> --- a/drivers/media/usb/dvb-usb/gp8psk.c
> +++ b/drivers/media/usb/dvb-usb/gp8psk.c
> @@ -250,7 +250,7 @@ static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
>
>  static int gp8psk_frontend_attach(struct dvb_usb_adapter *adap)
>  {
> -       adap->fe_adap[0].fe = gp8psk_fe_attach(adap->dev);
> +       adap->fe_adap[0].fe = dvb_attach(gp8psk_fe_attach, adap->dev);
>         return 0;
>  }
>

Unfortunately this still didn't work:

[54856.150095] DVB: registering new adapter (Genpix SkyWalker-2 DVB-S receiver)
[54856.153874] DVB: Unable to find symbol gp8psk_fe_attach()
[54856.153972] dvb-usb: no frontend was attached by 'Genpix
SkyWalker-2 DVB-S receiver'
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/usb/dvb-usb/gp8psk-fe.c b/drivers/media/usb/dvb-usb/gp8psk-fe.c
index db6eb79cde07..ab7c6093436b 100644
--- a/drivers/media/usb/dvb-usb/gp8psk-fe.c
+++ b/drivers/media/usb/dvb-usb/gp8psk-fe.c
@@ -326,6 +326,7 @@  struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d)
 success:
 	return &s->fe;
 }
+EXPORT_SYMBOL_GPL(gp8psk_fe_attach);
 
 
 static struct dvb_frontend_ops gp8psk_fe_ops = {
diff --git a/drivers/media/usb/dvb-usb/gp8psk.c b/drivers/media/usb/dvb-usb/gp8psk.c
index 2829e3082d15..c3762c50e93b 100644
--- a/drivers/media/usb/dvb-usb/gp8psk.c
+++ b/drivers/media/usb/dvb-usb/gp8psk.c
@@ -250,7 +250,7 @@  static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 
 static int gp8psk_frontend_attach(struct dvb_usb_adapter *adap)
 {
-	adap->fe_adap[0].fe = gp8psk_fe_attach(adap->dev);
+	adap->fe_adap[0].fe = dvb_attach(gp8psk_fe_attach, adap->dev);
 	return 0;
 }