* [patch] [media] mantis_dvb: fix some error codes in mantis_dvb_init()
@ 2017-01-27 8:06 Dan Carpenter
2017-01-27 8:29 ` walter harms
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-01-27 8:06 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media, kernel-janitors
We should be returning negative error codes here or it leads to a crash.
This also silences a static checker warning.
drivers/media/pci/mantis/mantis_cards.c:250 mantis_pci_probe()
warn: 'mantis->dmxdev.dvbdev->fops' double freed
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/media/pci/mantis/mantis_dvb.c b/drivers/media/pci/mantis/mantis_dvb.c
index 5a71e1791cf5..0db4de3a2285 100644
--- a/drivers/media/pci/mantis/mantis_dvb.c
+++ b/drivers/media/pci/mantis/mantis_dvb.c
@@ -226,11 +226,12 @@ int mantis_dvb_init(struct mantis_pci *mantis)
goto err5;
} else {
if (mantis->fe = NULL) {
+ result = -ENOMEM;
dprintk(MANTIS_ERROR, 1, "FE <NULL>");
goto err5;
}
-
- if (dvb_register_frontend(&mantis->dvb_adapter, mantis->fe)) {
+ result = dvb_register_frontend(&mantis->dvb_adapter, mantis->fe);
+ if (result) {
dprintk(MANTIS_ERROR, 1, "ERROR: Frontend registration failed");
if (mantis->fe->ops.release)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] [media] mantis_dvb: fix some error codes in mantis_dvb_init()
2017-01-27 8:06 [patch] [media] mantis_dvb: fix some error codes in mantis_dvb_init() Dan Carpenter
@ 2017-01-27 8:29 ` walter harms
2017-01-27 9:46 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: walter harms @ 2017-01-27 8:29 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors
Am 27.01.2017 09:06, schrieb Dan Carpenter:
> We should be returning negative error codes here or it leads to a crash.
> This also silences a static checker warning.
>
> drivers/media/pci/mantis/mantis_cards.c:250 mantis_pci_probe()
> warn: 'mantis->dmxdev.dvbdev->fops' double freed
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/media/pci/mantis/mantis_dvb.c b/drivers/media/pci/mantis/mantis_dvb.c
> index 5a71e1791cf5..0db4de3a2285 100644
> --- a/drivers/media/pci/mantis/mantis_dvb.c
> +++ b/drivers/media/pci/mantis/mantis_dvb.c
> @@ -226,11 +226,12 @@ int mantis_dvb_init(struct mantis_pci *mantis)
> goto err5;
> } else {
> if (mantis->fe = NULL) {
> + result = -ENOMEM;
> dprintk(MANTIS_ERROR, 1, "FE <NULL>");
> goto err5;
> }
> -
> - if (dvb_register_frontend(&mantis->dvb_adapter, mantis->fe)) {
> + result = dvb_register_frontend(&mantis->dvb_adapter, mantis->fe);
> + if (result) {
> dprintk(MANTIS_ERROR, 1, "ERROR: Frontend registration failed");
>
> if (mantis->fe->ops.release)
hi,
just one remark:
the indent level is deep.
using if ( !mantis->hwconfig) return 0;
and killing the "else" would help with readability.
just my 2 cents
re,
wh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] [media] mantis_dvb: fix some error codes in mantis_dvb_init()
2017-01-27 8:29 ` walter harms
@ 2017-01-27 9:46 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-01-27 9:46 UTC (permalink / raw)
To: walter harms; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors
You're, of course, correct that this code could be cleaned up...
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-27 9:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-27 8:06 [patch] [media] mantis_dvb: fix some error codes in mantis_dvb_init() Dan Carpenter
2017-01-27 8:29 ` walter harms
2017-01-27 9:46 ` Dan Carpenter
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).