summaryrefslogtreecommitdiffstats
path: root/netrom/nrsdrv.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2017-07-28 14:10:07 +0200
committerRalf Baechle <ralf@linux-mips.org>2017-07-31 04:29:44 +0200
commitdaba307035faf4cc01f1ccb883b21281d91234cc (patch)
treeedbd5df9285303f281524fac8064866057ce35ce /netrom/nrsdrv.c
parent71b0582584ac5de97141ea207ddf17f7c938b2df (diff)
treewide: Kill assignments in if conditions.
Somewhat hard to read and the code base already has many overlong lines. Found with below spatch file and some manual editing in ax25/access.c to restore a comment lost by spatch. @parens@ expression E, F, G; binary operator X; statement S; @@ - if ((E = F) X G) + E = F; + if (E X G) S Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'netrom/nrsdrv.c')
-rw-r--r--netrom/nrsdrv.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/netrom/nrsdrv.c b/netrom/nrsdrv.c
index 90b7635..a026cb8 100644
--- a/netrom/nrsdrv.c
+++ b/netrom/nrsdrv.c
@@ -321,7 +321,8 @@ int main(int argc, char *argv[])
logging = TRUE;
break;
case 's':
- if ((speed = atoi(optarg)) <= 0) {
+ speed = atoi(optarg);
+ if (speed <= 0) {
fprintf(stderr, "nrsdrv: invalid speed %s\n", optarg);
return 1;
}
@@ -359,12 +360,14 @@ int main(int argc, char *argv[])
return 1;
}
- if ((kissfd = open(kissdev, O_RDWR)) == -1) {
+ kissfd = open(kissdev, O_RDWR);
+ if (kissfd == -1) {
perror("nrsdrv: open kiss device");
return 1;
}
- if ((nrsfd = open(nrsdev, O_RDWR)) == -1) {
+ nrsfd = open(nrsdev, O_RDWR);
+ if (nrsfd == -1) {
perror("nrsdrv: open nrs device");
return 1;
}
@@ -429,7 +432,8 @@ int main(int argc, char *argv[])
n = select(c, &read_fd, NULL, NULL, NULL);
if (FD_ISSET(kissfd, &read_fd)) {
- if ((n = read(kissfd, buffer, 512)) <= 0) {
+ n = read(kissfd, buffer, 512);
+ if (n <= 0) {
if (logging) {
syslog(LOG_INFO, "terminating on KISS device closure\n");
closelog();
@@ -440,7 +444,8 @@ int main(int argc, char *argv[])
}
if (FD_ISSET(nrsfd, &read_fd)) {
- if ((n = read(nrsfd, buffer, 512)) <= 0) {
+ n = read(nrsfd, buffer, 512);
+ if (n <= 0) {
if (logging) {
syslog(LOG_INFO, "terminating on NRS device closure\n");
closelog();