dvb: return -ENOMEM if kzalloc failed in dvb_usb_device_init()
PATCH 1/1 dvb: return -ENOMEM if kzalloc failed in dvb_usb_device_init()
If in a cold state and the download succeeded ret is zero, but we should return -ENOMEM.
---
Or shouldn't we?
drivers/media/dvb/dvb-usb/dvb-usb-init.c +1 -1
@@ -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;
Am Dienstag, 2. Februar 2010 15:29:46 schrieb Roel Kluin:
Quoted 6 lines
If in a cold state and the download succeeded ret is zero, but we should return
-ENOMEM.Signed-off-by Roel Kluin <[email protected]>---
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
Quoted 11 lines · Oliver Neukum
Am Dienstag, 2. Februar 2010 15:29:46 schrieb Roel Kluin:
Quoted 6 lines
If in a cold state and the download succeeded ret is zero, but we should return
-ENOMEM.Signed-off-by Roel Kluin <[email protected]>---
Or shouldn't we?We should and we do if cold==0.
The bug is caused by this:
Quoted 8 lines
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
Am Mittwoch, 3. Februar 2010 17:02:49 schrieb roel kluin:
Quoted 9 lines
Quoted 9 lines
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; }
Quoted 4 lines
Quoted 1 line
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