kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] V4L/DVB: remove unneeded null check in anysee_probe()
@ 2010-05-31 19:27 Dan Carpenter
  2010-06-16 15:56 ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2010-05-31 19:27 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Antti Palosaari, André Goddard Rosa, Jiri Kosina,
	linux-media, kernel-janitors

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 <error27@gmail.com>

diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c
index faca1ad..aa5c7d5 100644
--- a/drivers/media/dvb/dvb-usb/anysee.c
+++ b/drivers/media/dvb/dvb-usb/anysee.c
@@ -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[] = {

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

* Re: [patch] V4L/DVB: remove unneeded null check in anysee_probe()
  2010-05-31 19:27 [patch] V4L/DVB: remove unneeded null check in anysee_probe() Dan Carpenter
@ 2010-06-16 15:56 ` Jiri Kosina
  2010-07-05 17:14   ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Kosina @ 2010-06-16 15:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mauro Carvalho Chehab, Antti Palosaari, André Goddard Rosa,
	linux-media, kernel-janitors

On Mon, 31 May 2010, Dan Carpenter wrote:

> 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 <error27@gmail.com>
> 
> diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c
> index faca1ad..aa5c7d5 100644
> --- a/drivers/media/dvb/dvb-usb/anysee.c
> +++ b/drivers/media/dvb/dvb-usb/anysee.c
> @@ -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);

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,

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

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

* Re: [patch] V4L/DVB: remove unneeded null check in anysee_probe()
  2010-06-16 15:56 ` Jiri Kosina
@ 2010-07-05 17:14   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2010-07-05 17:14 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Dan Carpenter, Antti Palosaari, André Goddard Rosa,
	linux-media, kernel-janitors

Em 16-06-2010 12:56, Jiri Kosina escreveu:
> On Mon, 31 May 2010, Dan Carpenter wrote:
> 
>> 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 <error27@gmail.com>
>>
>> diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c
>> index faca1ad..aa5c7d5 100644
>> --- a/drivers/media/dvb/dvb-usb/anysee.c
>> +++ b/drivers/media/dvb/dvb-usb/anysee.c
>> @@ -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);
> 
> 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.

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

end of thread, other threads:[~2010-07-05 17:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-31 19:27 [patch] V4L/DVB: remove unneeded null check in anysee_probe() Dan Carpenter
2010-06-16 15:56 ` Jiri Kosina
2010-07-05 17:14   ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).