Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565763

[PATCH 7/7] dmasound_core: Adjust six function calls together with a variable assignment

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 7/7] dmasound_core: Adjust six function calls together with a variable assignment
Date 2017-01-24 11:30 +0100
Message-ID <t36wq-34u-11@gated-at.bofh.it> (permalink)
References <t36wq-34u-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] ALSA: Fine-tuning for several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-24 11:30 +0100
  [PATCH 7/7] dmasound_core: Adjust six function calls together with a  variable assignment SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-24 11:30 +0100
  [PATCH 2/7] ALSA: seq: Delete unnecessary checks in  snd_seq_ioctl_get_subscription() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-24 11:30 +0100
  [PATCH 1/7] ALSA: seq: Delete unnecessary checks in  snd_seq_ioctl_query_subs() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-24 11:30 +0100
  [PATCH 6/7] dmasound_core: Move two assignments for the variable  "ret" in state_open() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-24 11:30 +0100
    Re: [alsa-devel] [PATCH 6/7] dmasound_core: Move two assignments for  the variable "ret" in state_open() Clemens Ladisch <clemens@ladisch.de> - 2017-01-25 08:50 +0100
  [PATCH 5/7] ALSA: seq: Adjust 16 function calls together with a  variable assignment SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-24 11:30 +0100
  [PATCH 4/7] ALSA: seq: Delete unnecessary checks in  snd_seq_ioctl_subscribe_port() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-01-24 11:30 +0100

csiph-web