[PATCH 5/5] xen: Code style conformity

Anastasiia Lukianenko vicooodin at gmail.com
Wed Aug 19 14:42:21 CEST 2020


From: Anastasiia Lukianenko <anastasiia_lukianenko at epam.com>

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko at epam.com>
---
 drivers/xen/gnttab.c  |  3 ++-
 drivers/xen/pvblock.c | 12 ++++++------
 include/xen/gnttab.h  |  3 +--
 lib/sscanf.c          |  3 ++-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/xen/gnttab.c b/drivers/xen/gnttab.c
index becf7a79fb..9bf1091ab3 100644
--- a/drivers/xen/gnttab.c
+++ b/drivers/xen/gnttab.c
@@ -100,7 +100,8 @@ int gnttab_end_access(grant_ref_t ref)
 
 	nflags = gnttab_table[ref].flags;
 	do {
-		if ((flags = nflags) & (GTF_reading | GTF_writing)) {
+		flags = nflags;
+		if ((flags) & (GTF_reading | GTF_writing)) {
 			printf("WARNING: g.e. still in use! (%x)\n", flags);
 			return 0;
 		}
diff --git a/drivers/xen/pvblock.c b/drivers/xen/pvblock.c
index 76e82fbf41..87e33afeb0 100644
--- a/drivers/xen/pvblock.c
+++ b/drivers/xen/pvblock.c
@@ -294,8 +294,8 @@ static void shutdown_blkfront(struct blkfront_dev *dev)
 	snprintf(path, sizeof(path), "%s/state", dev->backend);
 	snprintf(nodename, sizeof(nodename), "%s/state", dev->nodename);
 
-	if ((err = xenbus_switch_state(XBT_NIL, nodename,
-				       XenbusStateClosing)) != NULL) {
+	err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosing);
+	if (err != NULL) {
 		printf("%s: error changing state to %d: %s\n", __func__,
 		       XenbusStateClosing, err);
 		goto close;
@@ -306,8 +306,8 @@ static void shutdown_blkfront(struct blkfront_dev *dev)
 		err = xenbus_wait_for_state_change(path, &state);
 	free(err);
 
-	if ((err = xenbus_switch_state(XBT_NIL, nodename,
-				       XenbusStateClosed)) != NULL) {
+	err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateClosed);
+	if (err != NULL) {
 		printf("%s: error changing state to %d: %s\n", __func__,
 		       XenbusStateClosed, err);
 		goto close;
@@ -319,8 +319,8 @@ static void shutdown_blkfront(struct blkfront_dev *dev)
 		free(err);
 	}
 
-	if ((err = xenbus_switch_state(XBT_NIL, nodename,
-				       XenbusStateInitialising)) != NULL) {
+	err = xenbus_switch_state(XBT_NIL, nodename, XenbusStateInitialising);
+	if (err != NULL) {
 		printf("%s: error changing state to %d: %s\n", __func__,
 		       XenbusStateInitialising, err);
 		goto close;
diff --git a/include/xen/gnttab.h b/include/xen/gnttab.h
index db1d5361fe..db615004aa 100644
--- a/include/xen/gnttab.h
+++ b/include/xen/gnttab.h
@@ -1,5 +1,4 @@
-/*
- * SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0
  *
  * (C) 2006, Steven Smith <sos22 at cam.ac.uk>
  * (C) 2006, Grzegorz Milos <gm281 at cam.ac.uk>
diff --git a/lib/sscanf.c b/lib/sscanf.c
index d1e2dc272c..4c35c035fe 100644
--- a/lib/sscanf.c
+++ b/lib/sscanf.c
@@ -555,7 +555,8 @@ literal:
 			if (flags & SUPPRESS) {
 				size_t sum = 0;
 
-				if ((n = inr) < width) {
+				n = inr;
+				if (n < width) {
 					sum += n;
 					width -= n;
 					inp += n;
-- 
2.17.1



More information about the U-Boot mailing list