Skip to contentSkip to conversation

Staging: sound: drivers: aloop.c: fix usage of '=' in 'if' condition.

PATCH In review Sanjana Sanikommu 2 participants 2 messages Mar 17, 2019 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: sound: drivers: aloop.c: fix usage of '=' in 'if' condition.

fix usage of assignment operator '=' in if condition. Converted it into '=='. Issue found by checkpatch.pl semantic patch results for aloop.c.

ERROR: Dont use assignment operator in if condition.

---
 sound/drivers/mtpav.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/drivers/mtpav.c +2 -2
index 547662e02fcc..6e490ba50e83 100644
@@ -583,7 +583,7 @@ static irqreturn_t snd_mtpav_irqh(int irq, void *dev_id)
  */
 static int snd_mtpav_get_ISA(struct mtpav *mcard)
 {
-	if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) {
+	if ((mcard->res_port == request_region(port, 3, "MotuMTPAV MIDI")) == NULL) {
 		snd_printk(KERN_ERR "MTVAP port 0x%lx is busy\n", port);
 		return -EBUSY;
 	}
@@ -645,7 +645,7 @@ static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard)
 		hwports = 8;
 	mcard->num_ports = hwports;
 
-	if ((rval = snd_rawmidi_new(mcard->card, "MotuMIDI", 0,
+	if ((rval == snd_rawmidi_new(mcard->card, "MotuMIDI", 0,
 				    mcard->num_ports * 2 + MTPAV_PIDX_BROADCAST + 1,
 				    mcard->num_ports * 2 + MTPAV_PIDX_BROADCAST + 1,
 				    &mcard->rmidi)) < 0)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 5 lines · Sanjana Sanikommu

fix usage of assignment operator '=' in if condition. Converted it into '=='. Issue found by checkpatch.pl semantic patch results for aloop.c.

ERROR: Dont use assignment operator in if condition.

This is unlikely to be the right fix, as it massively changes the semantics. The correct change would be to move the assignment out of the if to a preceding statement.

julia

Quoted 38 lines
---
 sound/drivers/mtpav.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/drivers/mtpav.c +2 -3
index 547662e02fcc..6e490ba50e83 100644
@@ -583,7 +583,7 @@ static irqreturn_t snd_mtpav_irqh(int irq, void *dev_id)
  */
 static int snd_mtpav_get_ISA(struct mtpav *mcard)
 {
-	if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) {
+	if ((mcard->res_port == request_region(port, 3, "MotuMTPAV MIDI")) == NULL) {
 		snd_printk(KERN_ERR "MTVAP port 0x%lx is busy\n", port);
 		return -EBUSY;
 	}
@@ -645,7 +645,7 @@ static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard)
 		hwports = 8;
 	mcard->num_ports = hwports;
 
-	if ((rval = snd_rawmidi_new(mcard->card, "MotuMIDI", 0,
+	if ((rval == snd_rawmidi_new(mcard->card, "MotuMIDI", 0,
 				    mcard->num_ports * 2 + MTPAV_PIDX_BROADCAST + 1,
 				    mcard->num_ports * 2 + MTPAV_PIDX_BROADCAST + 1,
 				    &mcard->rmidi)) < 0)
--

2.17.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20190317082908.3246-1-sanjana99reddy99%40gmail.com.
For more options, visit https://groups.google.com/d/optout.