summaryrefslogtreecommitdiffstats
path: root/hdlcutil
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 /hdlcutil
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 'hdlcutil')
-rw-r--r--hdlcutil/hdrvcomm.c19
-rw-r--r--hdlcutil/smdiag.c6
-rw-r--r--hdlcutil/smmixer.c12
3 files changed, 25 insertions, 12 deletions
diff --git a/hdlcutil/hdrvcomm.c b/hdlcutil/hdrvcomm.c
index 1e0b806..a037fac 100644
--- a/hdlcutil/hdrvcomm.c
+++ b/hdlcutil/hdrvcomm.c
@@ -201,7 +201,8 @@ void hdrvc_init(void)
if (fd >= 0)
close(fd);
afpacket = 0;
- if ((fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_AX25))) < 0) {
+ fd = socket(PF_INET, SOCK_PACKET, htons(ETH_P_AX25));
+ if (fd < 0) {
fprintf(stderr, "%s: Error %s (%i), cannot open %s\n",
prg_name,
strerror(errno), errno, if_name);
@@ -234,7 +235,8 @@ void hdrvc_init(void)
strerror(errno), errno, if_name);
exit(-1);
}
- if ((msqid = msgget(k, 0700)) < 0) {
+ msqid = msgget(k, 0700);
+ if (msqid < 0) {
fprintf(stderr, "%s: Error %s (%i), cannot msgget %d\n", prg_name,
strerror(errno), errno, k);
exit(-1);
@@ -255,7 +257,9 @@ static int hdrvc_recvmsg(struct usersmmsg *msg, int maxlen, long type)
{
int len;
- if ((len = msgrcv(msqid, (struct msgbuf *)msg, maxlen-sizeof(long), type, MSG_NOERROR)) < 0) {
+ len = msgrcv(msqid, (struct msgbuf *)msg, maxlen - sizeof(long), type,
+ MSG_NOERROR);
+ if (len < 0) {
perror("msgrcv");
exit(1);
}
@@ -405,7 +409,8 @@ int hdrvc_get_channel_access_param(struct hdrvc_channel_params *par)
int ret;
struct usersmmsg msg;
- if ((ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_GETCHANNELPAR, &hi)) < 0)
+ ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_GETCHANNELPAR, &hi);
+ if (ret < 0)
return ret;
if (!par) {
errno = EINVAL;
@@ -449,7 +454,8 @@ int hdrvc_set_channel_access_param(struct hdrvc_channel_params par)
hi.data.cp.slottime = par.slottime;
hi.data.cp.ppersist = par.ppersist;
hi.data.cp.fulldup = par.fulldup;
- if ((ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_SETCHANNELPAR, &hi)) < 0)
+ ret = hdrvc_hdlcdrv_ioctl(HDLCDRVCTL_SETCHANNELPAR, &hi);
+ if (ret < 0)
return ret;
return 0;
msg.hdr.type = USERSM_CMD_SET_CHACCESS_PAR;
@@ -549,7 +555,8 @@ int hdrvc_diag2(unsigned int mode, unsigned int flags, short *data,
smi.data.diag.samplesperbit = 0;
smi.data.diag.datalen = maxdatalen;
smi.data.diag.data = data;
- if ((ret = hdrvc_sm_ioctl(SMCTL_DIAGNOSE, &smi)) < 0)
+ ret = hdrvc_sm_ioctl(SMCTL_DIAGNOSE, &smi);
+ if (ret < 0)
return ret;
if (samplesperbit)
*samplesperbit = smi.data.diag.samplesperbit;
diff --git a/hdlcutil/smdiag.c b/hdlcutil/smdiag.c
index cb354f1..17ef026 100644
--- a/hdlcutil/smdiag.c
+++ b/hdlcutil/smdiag.c
@@ -368,8 +368,10 @@ int main(int argc, char *argv[])
}
printmode(mode, trigger);
for (;;) {
- if ((ret = hdrvc_diag2(mode, trigger, data, sizeof(data) / sizeof(short),
- &samplesperbit)) < 0) {
+ ret = hdrvc_diag2(mode, trigger, data,
+ sizeof(data) / sizeof(short),
+ &samplesperbit);
+ if (ret < 0) {
perror("hdrvc_diag2");
exit(1);
}
diff --git a/hdlcutil/smmixer.c b/hdlcutil/smmixer.c
index 69c56f6..a8ce152 100644
--- a/hdlcutil/smmixer.c
+++ b/hdlcutil/smmixer.c
@@ -72,7 +72,8 @@ static unsigned char get_mixer_reg(unsigned char addr)
struct sm_mixer_data mixdat;
mixdat.reg = addr;
- if ((i = do_mix_ioctl(SMCTL_GETMIXER, &mixdat)) < 0) {
+ i = do_mix_ioctl(SMCTL_GETMIXER, &mixdat);
+ if (i < 0) {
perror("do_mix_ioctl: SMCTL_GETMIXER");
exit(1);
}
@@ -389,21 +390,24 @@ static int set_mixer_ad1848(int argc, char *argv[])
}
} else if (!strncasecmp(argv[0], "sl=", 3)) {
mask |= 16;
- if ((isrcl = parse_ad_src(argv[0]+3)) < 0) {
+ isrcl = parse_ad_src(argv[0] + 3);
+ if (isrcl < 0) {
fprintf(stderr, "invalid input source, must "
"be either line, aux1, mic or dac\n");
return -1;
}
} else if (!strncasecmp(argv[0], "sr=", 3)) {
mask |= 32;
- if ((isrcr = parse_ad_src(argv[0]+3)) < 0) {
+ isrcr = parse_ad_src(argv[0] + 3);
+ if (isrcr < 0) {
fprintf(stderr, "invalid input source, must "
"be either line, aux1, mic or dac\n");
return -1;
}
} else if (!strncasecmp(argv[0], "s=", 2)) {
mask |= 48;
- if ((isrcl = isrcr = parse_ad_src(argv[0]+2)) < 0) {
+ isrcl = isrcr = parse_ad_src(argv[0] + 2);
+ if (isrcl < 0) {
fprintf(stderr, "invalid input source, must "
"be either line, aux1, mic or dac\n");
return -1;