]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
xen: Code style conformity
authorAnastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Fri, 21 Aug 2020 09:10:04 +0000 (12:10 +0300)
committerTom Rini <trini@konsulko.com>
Mon, 24 Aug 2020 18:11:31 +0000 (14:11 -0400)
Cleaning up the following:

ERROR: do not use assignment in if condition
#281: FILE: drivers/xen/pvblock.c:260:
+       if ((err = xenbus_switch_state(XBT_NIL, nodename,
CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "err"
#52: FILE: drivers/xen/pvblock.c:298:
+       if (err != NULL) {
ERROR: do not use assignment in if condition
#176: FILE: drivers/xen/gnttab.c:103:
+               if ((flags = nflags) & (GTF_reading | GTF_writing)) {
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#329: FILE: include/xen/gnttab.h:1:
+/*
WARNING: Misplaced SPDX-License-Identifier tag - use line 1 instead
#330: FILE: include/xen/gnttab.h:2:
+ * SPDX-License-Identifier: GPL-2.0
ERROR: do not use assignment in if condition
#630: FILE: lib/sscanf.c:558:
+                               if ((n = inr) < width) {

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/xen/gnttab.c
drivers/xen/pvblock.c
include/xen/gnttab.h
lib/sscanf.c

index becf7a79fbfc18d394ff1feb8d33ccfd4ecf6122..9bf1091ab32109695b650b1aa920ee347bcf4b62 100644 (file)
@@ -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;
                }
index 76e82fbf41d89d3b188e5162d6ea8a3cd983beff..1b3325bbe2a385acd948f00936005f31cbb284db 100644 (file)
@@ -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) {
                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) {
                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) {
                printf("%s: error changing state to %d: %s\n", __func__,
                       XenbusStateInitialising, err);
                goto close;
index db1d5361fed500952ff7e5b8c801d2031bebcd05..db615004aa54c0ad7179a48032548b04555323ae 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0
  *
  * (C) 2006, Steven Smith <sos22@cam.ac.uk>
  * (C) 2006, Grzegorz Milos <gm281@cam.ac.uk>
index d1e2dc272cc976d27a9f20a39d121d992079892a..4c35c035fe108450d616db6a6e741394429a2645 100644 (file)
@@ -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;