lkml.org 
[lkml]   [2017]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 1/4] ASN.1: Adjust two function calls together with a variable assignment
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 10 Nov 2017 10:40:17 +0100

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/asn1_compiler.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
index c1b7ef3e24c1..e37e5ef3fabb 100644
--- a/scripts/asn1_compiler.c
+++ b/scripts/asn1_compiler.c
@@ -606,12 +606,14 @@ int main(int argc, char **argv)
exit(1);
}

- if (!(buffer = malloc(st.st_size + 1))) {
+ buffer = malloc(st.st_size + 1);
+ if (!buffer) {
perror(NULL);
exit(1);
}

- if ((readlen = read(fd, buffer, st.st_size)) < 0) {
+ readlen = read(fd, buffer, st.st_size);
+ if (readlen < 0) {
perror(filename);
exit(1);
}
--
2.15.0
\
 
 \ /
  Last update: 2017-11-10 13:47    [W:0.045 / U:2.168 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site