All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] dvb: return -ENOMEM if kzalloc failed in dvb_usb_device_init()
  2010-02-02 14:29 [PATCH] dvb: return -ENOMEM if kzalloc failed in dvb_usb_device_init() Roel Kluin
@ 2010-02-02 14:29 ` Oliver Neukum
  2010-02-03 16:02     ` roel kluin
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Neukum @ 2010-02-02 14:29 UTC (permalink / raw)
  To: Roel Kluin; +Cc: Mauro Carvalho Chehab, linux-media, Andrew Morton, LKML

Am Dienstag, 2. Februar 2010 15:29:46 schrieb Roel Kluin:
> If in a cold state and the download succeeded ret is zero, but we
> should return -ENOMEM.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Or shouldn't we?

We should and we do if cold==0.
The bug is caused by this:

	if (cold) {
		info("found a '%s' in cold state, will try to load a firmware",desc->name);
		ret = dvb_usb_download_firmware(udev,props);
		if (!props->no_reconnect || ret != 0)
			return ret;
	}

which overwrites ret

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] dvb: return -ENOMEM if kzalloc failed in dvb_usb_device_init()
@ 2010-02-02 14:29 Roel Kluin
  2010-02-02 14:29 ` Oliver Neukum
  0 siblings, 1 reply; 5+ messages in thread
From: Roel Kluin @ 2010-02-02 14:29 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Andrew Morton, LKML

If in a cold state and the download succeeded ret is zero, but we
should return -ENOMEM.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Or shouldn't we?

diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c
index e331db8..5d91f70 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c
@@ -243,7 +243,7 @@ int dvb_usb_device_init(struct usb_interface *intf,
 		d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL);
 	if (d == NULL) {
 		err("no memory for 'struct dvb_usb_device'");
-		return ret;
+		return -ENOMEM;
 	}
 
 	d->udev = udev;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] dvb: return -ENOMEM if kzalloc failed in  dvb_usb_device_init()
  2010-02-02 14:29 ` Oliver Neukum
@ 2010-02-03 16:02     ` roel kluin
  0 siblings, 0 replies; 5+ messages in thread
From: roel kluin @ 2010-02-03 16:02 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: Mauro Carvalho Chehab, linux-media, Andrew Morton, LKML

On Tue, Feb 2, 2010 at 3:29 PM, Oliver Neukum <oliver@neukum.org> wrote:
> Am Dienstag, 2. Februar 2010 15:29:46 schrieb Roel Kluin:
>> If in a cold state and the download succeeded ret is zero, but we
>> should return -ENOMEM.
>>
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>> ---
>> Or shouldn't we?
>
> We should and we do if cold==0.
> The bug is caused by this:
>
>        if (cold) {
>                info("found a '%s' in cold state, will try to load a firmware",desc->name);
>                ret = dvb_usb_download_firmware(udev,props);
>                if (!props->no_reconnect || ret != 0)
>                        return ret;
>        }
>
> which overwrites ret

Is that an ack or do you want me to add an int (e.g. rc) that
handles the dvb_usb_download_firmware() return value?

Roel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dvb: return -ENOMEM if kzalloc failed in dvb_usb_device_init()
@ 2010-02-03 16:02     ` roel kluin
  0 siblings, 0 replies; 5+ messages in thread
From: roel kluin @ 2010-02-03 16:02 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: Mauro Carvalho Chehab, linux-media, Andrew Morton, LKML

On Tue, Feb 2, 2010 at 3:29 PM, Oliver Neukum <oliver@neukum.org> wrote:
> Am Dienstag, 2. Februar 2010 15:29:46 schrieb Roel Kluin:
>> If in a cold state and the download succeeded ret is zero, but we
>> should return -ENOMEM.
>>
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>> ---
>> Or shouldn't we?
>
> We should and we do if cold==0.
> The bug is caused by this:
>
>        if (cold) {
>                info("found a '%s' in cold state, will try to load a firmware",desc->name);
>                ret = dvb_usb_download_firmware(udev,props);
>                if (!props->no_reconnect || ret != 0)
>                        return ret;
>        }
>
> which overwrites ret

Is that an ack or do you want me to add an int (e.g. rc) that
handles the dvb_usb_download_firmware() return value?

Roel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] dvb: return -ENOMEM if kzalloc failed in dvb_usb_device_init()
  2010-02-03 16:02     ` roel kluin
  (?)
@ 2010-02-03 16:16     ` Oliver Neukum
  -1 siblings, 0 replies; 5+ messages in thread
From: Oliver Neukum @ 2010-02-03 16:16 UTC (permalink / raw)
  To: roel kluin; +Cc: Mauro Carvalho Chehab, linux-media, Andrew Morton, LKML

Am Mittwoch, 3. Februar 2010 17:02:49 schrieb roel kluin:
> > The bug is caused by this:
> >
> >        if (cold) {
> >                info("found a '%s' in cold state, will try to load a firmware",desc->name);
> >                ret = dvb_usb_download_firmware(udev,props);
> >                if (!props->no_reconnect || ret != 0)
> >                        return ret;
> >        }
> >
> > which overwrites ret
> 
> Is that an ack or do you want me to add an int (e.g. rc) that
> handles the dvb_usb_download_firmware() return value?

This is an ack with an additional comment that this function is in need of
a cleanup due to unnecessary subtlety.

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-03 16:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02 14:29 [PATCH] dvb: return -ENOMEM if kzalloc failed in dvb_usb_device_init() Roel Kluin
2010-02-02 14:29 ` Oliver Neukum
2010-02-03 16:02   ` roel kluin
2010-02-03 16:02     ` roel kluin
2010-02-03 16:16     ` Oliver Neukum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.