Skip to contentSkip to conversation

mantis_dvb: fix some error codes in mantis_dvb_init()

PATCH In review Dan Carpenter 4 participants 10 messages Jan 27, 2017 – Feb 14, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mantis_dvb: fix some error codes in mantis_dvb_init()

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
drivers/media/pci/mantis/mantis_dvb.c +3 -2
index 5a71e1791cf5..0db4de3a2285 100644
@@ -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)
#1 lore raw

Am 27.01.2017 09:06, schrieb Dan Carpenter:

Quoted 17 lines

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
drivers/media/pci/mantis/mantis_dvb.c +1 -0
index 5a71e1791cf5..0db4de3a2285 100644
@@ -226,11 +226,12 @@ int mantis_dvb_init(struct mantis_pci *mantis)
 			goto err5;
 		} else {
 			if (mantis->fe = NULL) {
+				result = -ENOMEM;

drivers/media/pci/mantis/mantis_dvb.c int mantis_dvb_init(struct mantis_pci *mantis) · line 237

Quoted 10 lines
drivers/media/pci/mantis/mantis_dvb.c +2 -2
 				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

#2 lore raw

You're, of course, correct that this code could be cleaned up...

regards,
dan carpenter

#3 lore raw

PATCH 1/1 add device IDs to ngene

In reply to Dan Carpenter
Author: Helmut Auer <[email protected]>
Date:   Fri Jan 27 09:09:35 2017 +0100

Adding 2 device ID's to ngene driver.

(quoted diff) +0 -0

b/drivers/media/pci/ngene/ngene-cards.c
index 423e8c8..88815bd 100644

drivers/media/pci/ngene/ngene-cards.c +2 -0
@@ -753,6 +753,8 @@ static const struct ngene_info ngene_info_terratec = {
 /****************************************************************************/
 
 static const struct pci_device_id ngene_id_tbl[] = {
+       NGENE_ID(0x18c3, 0xab04, ngene_info_cineS2),
+       NGENE_ID(0x18c3, 0xab05, ngene_info_cineS2v5),
        NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2),
        NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2),
        NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2),
#4 lore raw

PATCH 1/1 add device IDs to ngene

Author: Helmut Auer <[email protected]>
Date:   Fri Jan 27 09:09:35 2017 +0100

Adding 2 device ID's to ngene driver.

(quoted diff) +0 -0

b/drivers/media/pci/ngene/ngene-cards.c
index 423e8c8..88815bd 100644

drivers/media/pci/ngene/ngene-cards.c +2 -0
@@ -753,6 +753,8 @@ static const struct ngene_info ngene_info_terratec = {
 /****************************************************************************/
 
 static const struct pci_device_id ngene_id_tbl[] = {
+       NGENE_ID(0x18c3, 0xab04, ngene_info_cineS2),
+       NGENE_ID(0x18c3, 0xab05, ngene_info_cineS2v5),
        NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2),
        NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2),
        NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2),
#5 lore raw

PATCH 1/1 add device ID to ati remote

Author: Helmut Auer <[email protected]>
Date:   Fri Jan 27 19:09:35 2017 +0100

Adding 1 device ID to ati_remote driver.

drivers/media/rc/ati_remote.c +5 -0
index 0884b7d..83022b1 100644
@@ -108,6 +108,7 @@
 #define NVIDIA_REMOTE_PRODUCT_ID       0x0005
 #define MEDION_REMOTE_PRODUCT_ID       0x0006
 #define FIREFLY_REMOTE_PRODUCT_ID      0x0008
+#define REYCOM_REMOTE_PRODUCT_ID       0x000c
 
 #define DRIVER_VERSION         "2.2.1"
 #define DRIVER_AUTHOR           "Torrey Hoffman <[email protected]>"
@@ -227,6 +228,10 @@ static struct usb_device_id ati_remote_table[] = {
                USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID),
                .driver_info = (unsigned long)&type_firefly
        },
+       {
+               USB_DEVICE(ATI_REMOTE_VENDOR_ID, REYCOM_REMOTE_PRODUCT_ID),
+               .driver_info = (unsigned long)&type_firefly
+       },
        {}      /* Terminating entry */
 };
 
maintainer
#6 lore raw

Re: [PATCH] [MEDIA] add device ID to ati remote

Quoted 5 lines · On Tue, Feb 07, 2017 at 09:42:47AM +0100, [email protected] wrote:
Author: Helmut Auer <[email protected]>
Date:   Fri Jan 27 19:09:35 2017 +0100

Adding 1 device ID to ati_remote driver.

If possible, a more descriptive message would be preferred, e.g. what device do you have, what branding, what product did it come with.

Quoted 2 lines

Unless I'm mistaken, contributions can't be anonymous or use a fake email address.

Quoted 14 lines
drivers/media/rc/ati_remote.c +1 -0
index 0884b7d..83022b1 100644
@@ -108,6 +108,7 @@
 #define NVIDIA_REMOTE_PRODUCT_ID       0x0005
 #define MEDION_REMOTE_PRODUCT_ID       0x0006
 #define FIREFLY_REMOTE_PRODUCT_ID      0x0008
+#define REYCOM_REMOTE_PRODUCT_ID       0x000c
 
 #define DRIVER_VERSION         "2.2.1"
 #define DRIVER_AUTHOR           "Torrey Hoffman <[email protected]>"

drivers/media/rc/ati_remote.c static struct usb_device_id ati_remote_table[] = { · line 236

Quoted 9 lines
drivers/media/rc/ati_remote.c +4 -0
@@ -227,6 +228,10 @@ static struct usb_device_id ati_remote_table[] = {
                USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID),
                .driver_info = (unsigned long)&type_firefly
        },
+       {
+               USB_DEVICE(ATI_REMOTE_VENDOR_ID, REYCOM_REMOTE_PRODUCT_ID),
+               .driver_info = (unsigned long)&type_firefly
+       },
        {}      /* Terminating entry */
 };

Your email client replaced all tabs with spaces so the patch no longer applies.

Thanks,
Sean

#7 lore raw

Re: [PATCH] [MEDIA] add device ID to ati remote

Hello

Thanks for the info, but sorry I'm not willinmg to do anything more to get the patch into the kernel. I have an own distribution and I am applying those patches and thats easier than committing it to the kernel ;) Maybe anyone who needs this finds this patch.

Kind regards
Helmut

Am 13.02.2017 um 14:42 schrieb Sean Young:

Quoted 46 lines · On Tue, Feb 07, 2017 at 09:42:47AM +0100, [email protected] wrote:
Quoted 5 lines
Author: Helmut Auer <[email protected]>
Date:   Fri Jan 27 19:09:35 2017 +0100

Adding 1 device ID to ati_remote driver.

If possible, a more descriptive message would be preferred, e.g. what device do you have, what branding, what product did it come with.

Quoted 2 lines

Unless I'm mistaken, contributions can't be anonymous or use a fake email address.

Quoted 14 lines
drivers/media/rc/ati_remote.c +1 -0
index 0884b7d..83022b1 100644
@@ -108,6 +108,7 @@
  #define NVIDIA_REMOTE_PRODUCT_ID       0x0005
  #define MEDION_REMOTE_PRODUCT_ID       0x0006
  #define FIREFLY_REMOTE_PRODUCT_ID      0x0008
+#define REYCOM_REMOTE_PRODUCT_ID       0x000c
 
  #define DRIVER_VERSION         "2.2.1"
  #define DRIVER_AUTHOR           "Torrey Hoffman <[email protected]>"

drivers/media/rc/ati_remote.c static struct usb_device_id ati_remote_table[] = { · line 236

Quoted 9 lines
drivers/media/rc/ati_remote.c +4 -0
@@ -227,6 +228,10 @@ static struct usb_device_id ati_remote_table[] = {
                 USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID),
                 .driver_info = (unsigned long)&type_firefly
         },
+       {
+               USB_DEVICE(ATI_REMOTE_VENDOR_ID, REYCOM_REMOTE_PRODUCT_ID),
+               .driver_info = (unsigned long)&type_firefly
+       },
         {}      /* Terminating entry */
  };

Your email client replaced all tabs with spaces so the patch no longer applies.

Thanks,
Sean

#8 lore raw

Re: [PATCH] [MEDIA] add device ID to ati remote

In reply to Sean Young

P.S. Here is the patch again with a correction.

Quoted 46 lines · On Tue, Feb 07, 2017 at 09:42:47AM +0100, [email protected] wrote:
Quoted 5 lines
Author: Helmut Auer <[email protected]>
Date:   Fri Jan 27 19:09:35 2017 +0100

Adding 1 device ID to ati_remote driver.

If possible, a more descriptive message would be preferred, e.g. what device do you have, what branding, what product did it come with.

Quoted 2 lines

Unless I'm mistaken, contributions can't be anonymous or use a fake email address.

Quoted 25 lines
drivers/media/rc/ati_remote.c +5 -0
index 0884b7d..83022b1 100644
@@ -108,6 +108,7 @@
 #define NVIDIA_REMOTE_PRODUCT_ID       0x0005
 #define MEDION_REMOTE_PRODUCT_ID       0x0006
 #define FIREFLY_REMOTE_PRODUCT_ID      0x0008
+#define REYCOM_REMOTE_PRODUCT_ID       0x000c
 
 #define DRIVER_VERSION         "2.2.1"
 #define DRIVER_AUTHOR           "Torrey Hoffman <[email protected]>"
@@ -227,6 +228,10 @@ static struct usb_device_id ati_remote_table[] = {
                USB_DEVICE(ATI_REMOTE_VENDOR_ID,
 FIREFLY_REMOTE_PRODUCT_ID),
                .driver_info = (unsigned long)&type_firefly
        },
+       {
+               USB_DEVICE(ATI_REMOTE_VENDOR_ID,
 REYCOM_REMOTE_PRODUCT_ID),
+               .driver_info = (unsigned long)&type_firefly
+       },
        {}      /* Terminating entry */
Quoted 1 line

};

Your email client replaced all tabs with spaces so the patch no longer applies.

Quoted 3 lines

Thanks,
Sean

media/rc/ati_remote.c +5 -0
@@ -108,6 +108,7 @@
 #define NVIDIA_REMOTE_PRODUCT_ID	0x0005
 #define MEDION_REMOTE_PRODUCT_ID	0x0006
 #define FIREFLY_REMOTE_PRODUCT_ID	0x0008
+#define REYCOM_REMOTE_PRODUCT_ID	0x000c
 
 #define DRIVER_VERSION		"2.2.1"
 #define DRIVER_AUTHOR           "Torrey Hoffman <[email protected]>"
@@ -227,6 +228,10 @@
 		USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID),
 		.driver_info = (unsigned long)&type_firefly
 	},
+	{
+		USB_DEVICE(ATI_REMOTE_VENDOR_ID, REYCOM_REMOTE_PRODUCT_ID),
+		.driver_info = (unsigned long)&type_medion
+	},
 	{}	/* Terminating entry */
 };
 
#9 lore raw

PATCH 1/1 add device IDs to ngene driver

In reply to [email protected]
Author: Helmut Auer <[email protected]>
Date:   Fri Jan 27 09:09:35 2017 +0100

Adding 2 device ID's to ngene driver.

--- drivers/media/pci/ngene/ngene-cards.c 2016-12-11
20:17:54.000000000 +0100
+++ drivers/media/pci/ngene/ngene-cards.c 2017-01-20
08:46:48.263666132 +0100
@@ -753,6 +753,8 @@
/****************************************************************************/

static const struct pci_device_id ngene_id_tbl[] = {
+ NGENE_ID(0x18c3, 0xab04, ngene_info_cineS2),
+ NGENE_ID(0x18c3, 0xab05, ngene_info_cineS2v5),
NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2),