[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.1008161826140.19313@ask.diku.dk>
Date:	Mon, 16 Aug 2010 18:26:36 +0200 (CEST)
From:	Julia Lawall <julia@...u.dk>
To:	Greg Kroah-Hartman <gregkh@...e.de>, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 7/16] drivers/staging: Use available error codes
From: Julia Lawall <julia@...u.dk>
An error code is stored in a variable, but 0 is returned instead.  Use the
variable instead of 0.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
local idexpression x;
constant C;
@@
if (...) { ...
  x = -C
  ... when != x
(
  return <+...x...+>;
|
  return NULL;
|
  return;
|
* return ...;
)
}
// </smpl>
Signed-off-by: Julia Lawall <julia@...u.dk>
---
This changes the semantics and is not tested.
 drivers/staging/lirc/lirc_sasem.c |    2 +-
 drivers/staging/sep/sep_driver.c  |    4 ++--
 drivers/staging/vt6655/iwctl.c    |    2 +-
 drivers/staging/vt6656/iwctl.c    |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/lirc/lirc_sasem.c b/drivers/staging/lirc/lirc_sasem.c
index 73166c3..856487e 100644
--- a/drivers/staging/lirc/lirc_sasem.c
+++ b/drivers/staging/lirc/lirc_sasem.c
@@ -512,7 +512,7 @@ exit:
 	mutex_unlock(&context->ctx_lock);
 
 	mutex_unlock(&disconnect_lock);
-	return 0;
+	return retval;
 }
 
 /**
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index ecbde34..604965c 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -844,7 +844,7 @@ static int sep_lock_kernel_pages(struct sep_device *sep,
 	*page_array_ptr = 0;
 end_function:
 	dbg("SEP Driver:<-------- sep_lock_kernel_pages end\n");
-	return 0;
+	return error;
 }
 
 /*
@@ -972,7 +972,7 @@ end_function_with_error1:
 	kfree(page_array);
 end_function:
 	dbg("SEP Driver:<-------- sep_lock_user_pages end\n");
-	return 0;
+	return error;
 }
 
 
diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index 4322761..4009c0b 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -1900,7 +1900,7 @@ int iwctl_siwgenie(struct net_device *dev,
 	}
 
 	out://not completely ...not necessary in wpa_supplicant 0.5.8
-	return 0;
+	return ret;
 }
 
 int iwctl_giwgenie(struct net_device *dev,
diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c
index 016b8e7..8fb6518 100644
--- a/drivers/staging/vt6656/iwctl.c
+++ b/drivers/staging/vt6656/iwctl.c
@@ -1726,7 +1726,7 @@ int iwctl_siwgenie(struct net_device *dev,
 	}
 
 	out://not completely ...not necessary in wpa_supplicant 0.5.8
-	return 0;
+	return ret;
 }
 
 int iwctl_giwgenie(struct net_device *dev,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists