V4L/DVB: remove unneeded null check in anysee_probe()
Subsystems (2)
PATCH 1/1 V4L/DVB: remove unneeded null check in anysee_probe()
Smatch complained because "d" is dereferenced first and then checked for null later . The only code path where "d" could be a invalid pointer is if this is a cold device in dvb_usb_device_init(). I consulted Antti Palosaari and he explained that anysee is always a warm device.
I have added a comment and removed the unneeded null check.
drivers/media/dvb/dvb-usb/anysee.c +6 -4
@@ -463,6 +463,11 @@ static int anysee_probe(struct usb_interface *intf,if (intf->num_altsetting <1 )return -ENODEV ; +/* +* Anysee is always warm (its USB-bridge, Cypress FX2, uploads +* firmware from eeprom). If dvb_usb_device_init() succeeds that +* means d is a valid pointer. +*/ ret =dvb_usb_device_init (intf, &anysee_properties,THIS_MODULE , &d, adapter_nr);if (ret)
@@ -479,10 +484,7 @@ static int anysee_probe(struct usb_interface *intf,if (ret)return ret; -if (d) - ret =anysee_init (d); - -return ret; +return anysee_init (d); }static struct usb_device_id anysee_table[] = {
Quoted 26 lines · Dan Carpenter
Smatch complained because "d" is dereferenced first and then checked for null later . The only code path where "d" could be a invalid pointer is if this is a cold device in
dvb_usb_device_init(). I consulted Antti Palosaari and he explained that anysee is always a warm device.I have added a comment and removed the unneeded null check.
Signed-off-by Dan Carpenter <[email protected]>drivers/media/dvb/dvb-usb/anysee.c +5
-0@@ -463,6 +463,11 @@ static int anysee_probe(struct usb_interface *intf,if (intf->num_altsetting <1 )return -ENODEV ; +/* +* Anysee is always warm (its USB-bridge, Cypress FX2, uploads +* firmware from eeprom). If dvb_usb_device_init() succeeds that +* means d is a valid pointer. +*/ ret =dvb_usb_device_init (intf, &anysee_properties,THIS_MODULE , &d, adapter_nr);if (ret)
drivers/media/dvb/dvb-usb/anysee.c static int anysee_probe(struct usb_interface *intf, · line 487
Quoted 8 lines
drivers/media/dvb/dvb-usb/anysee.c +1
-4@@ -479,10 +484,7 @@ static int anysee_probe(struct usb_interface *intf,if (ret)return ret; -if (d) - ret =anysee_init (d); - -return ret; +return anysee_init (d);
Doesn't seem to be present in linux-next as of today. Mauro, will you take it?
Or I can take it if you ack it.
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.
Em 16-06-2010 12:56, Jiri Kosina escreveu:
Quoted 31 lines · Dan Carpenter
Quoted 30 lines
Smatch complained because "d" is dereferenced first and then checked for null later . The only code path where "d" could be a invalid pointer is if this is a cold device in
dvb_usb_device_init(). I consulted Antti Palosaari and he explained that anysee is always a warm device.I have added a comment and removed the unneeded null check.
Signed-off-by Dan Carpenter <[email protected]>drivers/media/dvb/dvb-usb/anysee.c +5
-0@@ -463,6 +463,11 @@ static int anysee_probe(struct usb_interface *intf,if (intf->num_altsetting <1 )return -ENODEV ; +/* +* Anysee is always warm (its USB-bridge, Cypress FX2, uploads +* firmware from eeprom). If dvb_usb_device_init() succeeds that +* means d is a valid pointer. +*/ ret =dvb_usb_device_init (intf, &anysee_properties,THIS_MODULE , &d, adapter_nr);if (ret)@@ -479,10 +484,7 @@ static int anysee_probe(struct usb_interface *intf,if (ret)return ret;
Quoted 9 lines
drivers/media/dvb/dvb-usb/anysee.c static int anysee_probe(struct usb_interface *intf, · line 487
Quoted 5 lines
drivers/media/dvb/dvb-usb/anysee.c +1
-4-if (d) - ret =anysee_init (d); - -return ret; +return anysee_init (d);Doesn't seem to be present in linux-next as of today. Mauro, will you take it?
Or I can take it if you ack it.
Sorry, I'm delayed on applying patches on my tree, due to two long trips and the huge amount of patches that were sent those days.
I'm applying it on my tree right now.
Cheers,
Mauro.