Ver Fonte

USB rio500.c: fix check-after-use

The Coverity checker spotted that we have already oops'ed if "dev"
was NULL in these places.

Since "dev" being NULL isn't possible at these places this patch removes
the NULL checks.

Additionally, I've fixed the formatting of the if's.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Adrian Bunk há 17 anos atrás
pai
commit
3328d9752f
1 ficheiros alterados com 3 adições e 12 exclusões
  1. 3 12
      drivers/usb/misc/rio500.c

+ 3 - 12
drivers/usb/misc/rio500.c

@@ -118,10 +118,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd,
 
 
 	mutex_lock(&(rio->lock));
 	mutex_lock(&(rio->lock));
         /* Sanity check to make sure rio is connected, powered, etc */
         /* Sanity check to make sure rio is connected, powered, etc */
-        if ( rio == NULL ||
-             rio->present == 0 ||
-             rio->rio_dev == NULL )
-	{
+        if (rio->present == 0 || rio->rio_dev == NULL) {
 		retval = -ENODEV;
 		retval = -ENODEV;
 		goto err_out;
 		goto err_out;
 	}
 	}
@@ -280,10 +277,7 @@ write_rio(struct file *file, const char __user *buffer,
 	if (intr)
 	if (intr)
 		return -EINTR;
 		return -EINTR;
         /* Sanity check to make sure rio is connected, powered, etc */
         /* Sanity check to make sure rio is connected, powered, etc */
-        if ( rio == NULL ||
-             rio->present == 0 ||
-             rio->rio_dev == NULL )
-	{
+        if (rio->present == 0 || rio->rio_dev == NULL) {
 		mutex_unlock(&(rio->lock));
 		mutex_unlock(&(rio->lock));
 		return -ENODEV;
 		return -ENODEV;
 	}
 	}
@@ -369,10 +363,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos)
 	if (intr)
 	if (intr)
 		return -EINTR;
 		return -EINTR;
 	/* Sanity check to make sure rio is connected, powered, etc */
 	/* Sanity check to make sure rio is connected, powered, etc */
-        if ( rio == NULL ||
-             rio->present == 0 ||
-             rio->rio_dev == NULL )
-	{
+        if (rio->present == 0 || rio->rio_dev == NULL) {
 		mutex_unlock(&(rio->lock));
 		mutex_unlock(&(rio->lock));
 		return -ENODEV;
 		return -ENODEV;
 	}
 	}