From mboxrd@z Thu Jan 1 00:00:00 1970 From: walter harms Date: Fri, 27 Jan 2017 08:29:04 +0000 Subject: Re: [patch] [media] mantis_dvb: fix some error codes in mantis_dvb_init() Message-Id: <588B04D0.7020401@bfs.de> List-Id: References: <20170127080622.GA4153@mwanda> In-Reply-To: <20170127080622.GA4153@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org 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 > > 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 "); > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx02-sz.bfs.de ([194.94.69.103]:4172 "EHLO mx02-sz.bfs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754220AbdA0Iek (ORCPT ); Fri, 27 Jan 2017 03:34:40 -0500 Message-ID: <588B04D0.7020401@bfs.de> Date: Fri, 27 Jan 2017 09:29:04 +0100 From: walter harms Reply-To: wharms@bfs.de MIME-Version: 1.0 To: Dan Carpenter CC: Mauro Carvalho Chehab , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [patch] [media] mantis_dvb: fix some error codes in mantis_dvb_init() References: <20170127080622.GA4153@mwanda> In-Reply-To: <20170127080622.GA4153@mwanda> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-media-owner@vger.kernel.org List-ID: 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 > > 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 "); > 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