public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] drivers/usb/misc/sisusbvga/sisusb.c: remove dead code
@ 2005-11-20 23:22 Adrian Bunk
  2005-11-23 19:02 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2005-11-20 23:22 UTC (permalink / raw)
  To: gregkh, Thomas Winischhofer; +Cc: linux-usb-devel, linux-kernel

The Coverity checker found this obviously dead code.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/usb/misc/sisusbvga/sisusb.c |    6 ------
 1 file changed, 6 deletions(-)

--- linux-2.6.15-rc1-mm2-full/drivers/usb/misc/sisusbvga/sisusb.c.old	2005-11-20 22:56:41.000000000 +0100
+++ linux-2.6.15-rc1-mm2-full/drivers/usb/misc/sisusbvga/sisusb.c	2005-11-20 22:58:22.000000000 +0100
@@ -861,13 +861,10 @@
 
 	while (length) {
 
 	    switch (length) {
 
-		case 0:
-			return ret;
-
 		case 1:
 			if (userbuffer) {
 				if (get_user(swap8, (u8 __user *)userbuffer))
 					return -EFAULT;
 			} else
@@ -1219,13 +1216,10 @@
 
 	while (length) {
 
 	    switch (length) {
 
-		case 0:
-			return ret;
-
 		case 1:
 
 			ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM,
 								addr, &buf[0]);
 			if (!ret) {


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

* Re: [2.6 patch] drivers/usb/misc/sisusbvga/sisusb.c: remove dead code
  2005-11-20 23:22 [2.6 patch] drivers/usb/misc/sisusbvga/sisusb.c: remove dead code Adrian Bunk
@ 2005-11-23 19:02 ` Greg KH
  2005-11-23 20:31   ` Adrian Bunk
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2005-11-23 19:02 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: gregkh, Thomas Winischhofer, linux-usb-devel, linux-kernel

On Mon, Nov 21, 2005 at 12:22:39AM +0100, Adrian Bunk wrote:
> The Coverity checker found this obviously dead code.

I think the checker is wrong, this does not look correct to me.

thanks,

greg k-h

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

* Re: [2.6 patch] drivers/usb/misc/sisusbvga/sisusb.c: remove dead code
  2005-11-23 19:02 ` Greg KH
@ 2005-11-23 20:31   ` Adrian Bunk
  2005-11-28 20:52     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2005-11-23 20:31 UTC (permalink / raw)
  To: Greg KH; +Cc: gregkh, Thomas Winischhofer, linux-usb-devel, linux-kernel

On Wed, Nov 23, 2005 at 11:02:37AM -0800, Greg KH wrote:
> On Mon, Nov 21, 2005 at 12:22:39AM +0100, Adrian Bunk wrote:
> > The Coverity checker found this obviously dead code.
> 
> I think the checker is wrong, this does not look correct to me.

Why?

Due to the while(length), length can't be 0 at the switch.

> thanks,
> 
> greg k-h

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [2.6 patch] drivers/usb/misc/sisusbvga/sisusb.c: remove dead code
  2005-11-23 20:31   ` Adrian Bunk
@ 2005-11-28 20:52     ` Greg KH
  2005-11-29 10:25       ` Thomas Winischhofer
  2005-11-29 13:01       ` Adrian Bunk
  0 siblings, 2 replies; 6+ messages in thread
From: Greg KH @ 2005-11-28 20:52 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: gregkh, Thomas Winischhofer, linux-usb-devel, linux-kernel

On Wed, Nov 23, 2005 at 09:31:50PM +0100, Adrian Bunk wrote:
> On Wed, Nov 23, 2005 at 11:02:37AM -0800, Greg KH wrote:
> > On Mon, Nov 21, 2005 at 12:22:39AM +0100, Adrian Bunk wrote:
> > > The Coverity checker found this obviously dead code.
> > 
> > I think the checker is wrong, this does not look correct to me.
> 
> Why?
> 
> Due to the while(length), length can't be 0 at the switch.

Doh, ok, nevermind.  Care to resend this?

thanks,

greg k-h

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

* Re: [2.6 patch] drivers/usb/misc/sisusbvga/sisusb.c: remove dead code
  2005-11-28 20:52     ` Greg KH
@ 2005-11-29 10:25       ` Thomas Winischhofer
  2005-11-29 13:01       ` Adrian Bunk
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Winischhofer @ 2005-11-29 10:25 UTC (permalink / raw)
  To: Greg KH; +Cc: Adrian Bunk, gregkh, linux-usb-devel, linux-kernel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greg KH wrote:
> On Wed, Nov 23, 2005 at 09:31:50PM +0100, Adrian Bunk wrote:
> 
>>On Wed, Nov 23, 2005 at 11:02:37AM -0800, Greg KH wrote:
>>
>>>On Mon, Nov 21, 2005 at 12:22:39AM +0100, Adrian Bunk wrote:
>>>
>>>>The Coverity checker found this obviously dead code.
>>>
>>>I think the checker is wrong, this does not look correct to me.
>>
>>Why?
>>
>>Due to the while(length), length can't be 0 at the switch.
> 
> 
> Doh, ok, nevermind.  Care to resend this?


Took me also a few seconds to realize that the tool is correct. Nice stuff.

Thomas

- --
Thomas Winischhofer
Vienna/Austria
thomas AT winischhofer DOT net	       *** http://www.winischhofer.net

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDjCx8zydIRAktyUcRAi8NAKCA96Bt9ibOIRGQWhSUy6qnd5QxYwCeLtHE
VvGqTMgnn476dnm/PYKBSM8=
=3eHZ
-----END PGP SIGNATURE-----

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

* [2.6 patch] drivers/usb/misc/sisusbvga/sisusb.c: remove dead code
  2005-11-28 20:52     ` Greg KH
  2005-11-29 10:25       ` Thomas Winischhofer
@ 2005-11-29 13:01       ` Adrian Bunk
  1 sibling, 0 replies; 6+ messages in thread
From: Adrian Bunk @ 2005-11-29 13:01 UTC (permalink / raw)
  To: Greg KH; +Cc: gregkh, Thomas Winischhofer, linux-usb-devel, linux-kernel

On Mon, Nov 28, 2005 at 12:52:20PM -0800, Greg KH wrote:
> On Wed, Nov 23, 2005 at 09:31:50PM +0100, Adrian Bunk wrote:
> > On Wed, Nov 23, 2005 at 11:02:37AM -0800, Greg KH wrote:
> > > On Mon, Nov 21, 2005 at 12:22:39AM +0100, Adrian Bunk wrote:
> > > > The Coverity checker found this obviously dead code.
> > > 
> > > I think the checker is wrong, this does not look correct to me.
> > 
> > Why?
> > 
> > Due to the while(length), length can't be 0 at the switch.
> 
> Doh, ok, nevermind.  Care to resend this?

It's below.

> thanks,
> 
> greg k-h

cu
Adrian


<--  snip  -->


The Coverity checker found this dead code.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/usb/misc/sisusbvga/sisusb.c |    6 ------
 1 file changed, 6 deletions(-)

--- linux-2.6.15-rc1-mm2-full/drivers/usb/misc/sisusbvga/sisusb.c.old	2005-11-20 22:56:41.000000000 +0100
+++ linux-2.6.15-rc1-mm2-full/drivers/usb/misc/sisusbvga/sisusb.c	2005-11-20 22:58:22.000000000 +0100
@@ -861,13 +861,10 @@
 
 	while (length) {
 
 	    switch (length) {
 
-		case 0:
-			return ret;
-
 		case 1:
 			if (userbuffer) {
 				if (get_user(swap8, (u8 __user *)userbuffer))
 					return -EFAULT;
 			} else
@@ -1219,13 +1216,10 @@
 
 	while (length) {
 
 	    switch (length) {
 
-		case 0:
-			return ret;
-
 		case 1:
 
 			ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM,
 								addr, &buf[0]);
 			if (!ret) {


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

end of thread, other threads:[~2005-11-29 13:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-20 23:22 [2.6 patch] drivers/usb/misc/sisusbvga/sisusb.c: remove dead code Adrian Bunk
2005-11-23 19:02 ` Greg KH
2005-11-23 20:31   ` Adrian Bunk
2005-11-28 20:52     ` Greg KH
2005-11-29 10:25       ` Thomas Winischhofer
2005-11-29 13:01       ` Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox