From: SF Markus Elfring <elfring@users.sourceforge.net>
To: alsa-devel@alsa-project.org, Clemens Ladisch <clemens@ladisch.de>,
Jaroslav Kysela <perex@perex.cz>,
Martin Koegler <martin.koegler@chello.at>,
Takashi Iwai <tiwai@suse.com>,
Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 7/7] dmasound_core: Adjust six function calls together with a variable assignment
Date: Tue, 24 Jan 2017 11:27:19 +0100 [thread overview]
Message-ID: <43a0c4d3-d054-4be2-eab7-7ee37b62fca6@users.sourceforge.net> (raw)
In-Reply-To: <f2404d64-27c8-4afa-b893-fc72601c0136@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 24 Jan 2017 10:34:47 +0100
The script "checkpatch.pl" pointed information out like the following.
ERROR: do not use assignment in if condition
Thus fix affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/oss/dmasound/dmasound_core.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
index 2bdd1d619a7f..a20bf3b94329 100644
--- a/sound/oss/dmasound/dmasound_core.c
+++ b/sound/oss/dmasound/dmasound_core.c
@@ -576,7 +576,9 @@ static ssize_t sq_write(struct file *file, const char __user *src, size_t uLeft,
*/
if (write_sq.locked == 0) {
- if ((uWritten = sq_setup(&write_sq)) < 0) return uWritten ;
+ uWritten = sq_setup(&write_sq);
+ if (uWritten < 0)
+ return uWritten;
uWritten = 0 ;
}
@@ -675,7 +677,8 @@ static unsigned int sq_poll(struct file *file, struct poll_table_struct *wait)
int retVal;
if (write_sq.locked == 0) {
- if ((retVal = sq_setup(&write_sq)) < 0)
+ retVal = sq_setup(&write_sq);
+ if (retVal < 0)
return retVal;
return 0;
}
@@ -736,7 +739,8 @@ static int sq_open2(struct sound_queue *sq, struct file *file, fmode_t mode,
can't be changed at the moment - but _could_ be perhaps
in the setfragments ioctl.
*/
- if (( rc = sq_allocate_buffers(sq, numbufs, bufsize))) {
+ rc = sq_allocate_buffers(sq, numbufs, bufsize);
+ if (rc) {
#if 0 /* blocking open() */
sq_wake_up(sq, file, mode);
#else
@@ -1407,12 +1411,14 @@ int dmasound_init(void)
/* Set up sound queue, /dev/audio and /dev/dsp. */
/* Set default settings. */
- if ((res = sq_init()) < 0)
- return res ;
+ res = sq_init();
+ if (res < 0)
+ return res;
/* Set up /dev/sndstat. */
- if ((res = state_init()) < 0)
- return res ;
+ res = state_init();
+ if (res < 0)
+ return res;
/* Set up /dev/mixer. */
mixer_init();
@@ -1485,7 +1491,8 @@ static int dmasound_setup(char *str)
numWriteBufs = ints[1];
/* fall through */
case 1:
- if ((size = ints[2]) < 256) /* check for small buffer specs */
+ size = ints[2];
+ if (size < 256) /* check for small buffer specs */
size <<= 10 ;
if (size < MIN_BUFSIZE || size > MAX_BUFSIZE)
printk("dmasound_setup: invalid write buffer size, using default = %d\n", writeBufSize);
--
2.11.0
next prev parent reply other threads:[~2017-01-24 10:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 10:19 [PATCH 0/7] ALSA: Fine-tuning for several function implementations SF Markus Elfring
2017-01-24 10:21 ` [PATCH 1/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_query_subs() SF Markus Elfring
2017-01-24 10:22 ` [PATCH 2/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_get_subscription() SF Markus Elfring
2017-01-24 10:23 ` [PATCH 3/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_unsubscribe_port() SF Markus Elfring
2017-01-24 10:24 ` [PATCH 4/7] ALSA: seq: Delete unnecessary checks in snd_seq_ioctl_subscribe_port() SF Markus Elfring
2017-01-24 10:25 ` [PATCH 5/7] ALSA: seq: Adjust 16 function calls together with a variable assignment SF Markus Elfring
2017-01-24 10:26 ` [PATCH 6/7] dmasound_core: Move two assignments for the variable "ret" in state_open() SF Markus Elfring
2017-01-25 7:40 ` [alsa-devel] " Clemens Ladisch
2017-01-24 10:27 ` SF Markus Elfring [this message]
2017-11-14 11:48 ` [PATCH 0/7] ALSA: Fine-tuning for several function implementations SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43a0c4d3-d054-4be2-eab7-7ee37b62fca6@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.koegler@chello.at \
--cc=o-takashi@sakamocchi.jp \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).