Skip to contentSkip to conversation

Staging: lustre: Fix assignment in if condition checkpatch error

PATCH In review Dilek Uzulmez 2 participants 2 messages Mar 1, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: lustre: Fix assignment in if condition checkpatch error

Fix checkpatch.pl error assignment in if condition and assign variable before if condition.

---
 drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h +2 -3
index eea55d9..ae6901b 100644
@@ -77,10 +77,9 @@ enum {
 static inline int cfs_fail_check_set(__u32 id, __u32 value,
 				     int set, int quiet)
 {
-	int ret = 0;
+	int ret = __cfs_fail_check_set(id, value, set);
 
-	if (unlikely(CFS_FAIL_PRECHECK(id) &&
-		     (ret = __cfs_fail_check_set(id, value, set)))) {
+	if (unlikely(CFS_FAIL_PRECHECK(id) && ret)) {
 		if (quiet) {
 			CDEBUG(D_INFO, "*** cfs_fail_loc=%x, val=%u***\n",
 			       id, value);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 13 lines · Dilek Uzulmez

Fix checkpatch.pl error assignment in if condition and assign variable before if condition.

---
 drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h +0 -0
index eea55d9..ae6901b 100644

drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h enum { · line 82

Quoted 9 lines
drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h +2 -3
@@ -77,10 +77,9 @@ enum {
 static inline int cfs_fail_check_set(__u32 id, __u32 value,
 				     int set, int quiet)
 {
-	int ret = 0;
+	int ret = __cfs_fail_check_set(id, value, set);
 
-	if (unlikely(CFS_FAIL_PRECHECK(id) &&
-		     (ret = __cfs_fail_check_set(id, value, set)))) {
+	if (unlikely(CFS_FAIL_PRECHECK(id) && ret)) {

This inverses the order of __cfs_fail_check_set and CFS_FAIL_PRECHECK. You need to argue that this is safe to do, if that is indeed the case.

julia

Quoted 13 lines
drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h +0 -1
 		if (quiet) {
 			CDEBUG(D_INFO, "*** cfs_fail_loc=%x, val=%u***\n",
 			       id, value);
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1425242387-10440-1-git-send-email-dilekuzulmez%40gmail.com.
For more options, visit https://groups.google.com/d/optout.