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


Groups > linux.kernel > #1364889 > unrolled thread

[PATCH] Drivers: isdn: hisax: isac.c: Fix assignment and check into one expression.

Started byCosmin-Gabriel Samoila <gabrielcsmo@gmail.com>
First post2016-03-26 02:00 +0100
Last post2016-03-28 04:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Drivers: isdn: hisax: isac.c: Fix assignment and check into one expression. Cosmin-Gabriel Samoila <gabrielcsmo@gmail.com> - 2016-03-26 02:00 +0100
    Re: [PATCH] Drivers: isdn: hisax: isac.c: Fix assignment and check  into one expression. David Miller <davem@davemloft.net> - 2016-03-28 04:50 +0200

#1364889 — [PATCH] Drivers: isdn: hisax: isac.c: Fix assignment and check into one expression.

FromCosmin-Gabriel Samoila <gabrielcsmo@gmail.com>
Date2016-03-26 02:00 +0100
Subject[PATCH] Drivers: isdn: hisax: isac.c: Fix assignment and check into one expression.
Message-ID<rgKK6-1pu-9@gated-at.bofh.it>
Fix variable assignment inside if statement. It is error-prone and hard to read.

Signed-off-by: Cosmin-Gabriel Samoila <gabrielcsmo@gmail.com>
---
 drivers/isdn/hisax/isac.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/isdn/hisax/isac.c b/drivers/isdn/hisax/isac.c
index 7fdf78f..df7e05c 100644
--- a/drivers/isdn/hisax/isac.c
+++ b/drivers/isdn/hisax/isac.c
@@ -215,9 +215,11 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
 			if (count == 0)
 				count = 32;
 			isac_empty_fifo(cs, count);
-			if ((count = cs->rcvidx) > 0) {
+			count = cs->rcvidx;
+			if (count > 0) {
 				cs->rcvidx = 0;
-				if (!(skb = alloc_skb(count, GFP_ATOMIC)))
+				skb = alloc_skb(count, GFP_ATOMIC);
+				if (!skb)
 					printk(KERN_WARNING "HiSax: D receive out of memory\n");
 				else {
 					memcpy(skb_put(skb, count), cs->rcvbuf, count);
@@ -251,7 +253,8 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
 				cs->tx_skb = NULL;
 			}
 		}
-		if ((cs->tx_skb = skb_dequeue(&cs->sq))) {
+		cs->tx_skb = skb_dequeue(&cs->sq);
+		if (cs->tx_skb) {
 			cs->tx_cnt = 0;
 			isac_fill_fifo(cs);
 		} else
@@ -313,7 +316,8 @@ afterXPR:
 #if ARCOFI_USE
 			if (v1 & 0x08) {
 				if (!cs->dc.isac.mon_rx) {
-					if (!(cs->dc.isac.mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC))) {
+					cs->dc.isac.mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC);
+					if (!cs->dc.isac.mon_rx) {
 						if (cs->debug & L1_DEB_WARN)
 							debugl1(cs, "ISAC MON RX out of memory!");
 						cs->dc.isac.mocr &= 0xf0;
@@ -343,7 +347,8 @@ afterXPR:
 		afterMONR0:
 			if (v1 & 0x80) {
 				if (!cs->dc.isac.mon_rx) {
-					if (!(cs->dc.isac.mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC))) {
+					cs->dc.isac.mon_rx = kmalloc(MAX_MON_FRAME, GFP_ATOMIC);
+					if (!cs->dc.isac.mon_rx) {
 						if (cs->debug & L1_DEB_WARN)
 							debugl1(cs, "ISAC MON RX out of memory!");
 						cs->dc.isac.mocr &= 0x0f;
-- 
1.9.1

[toc] | [next] | [standalone]


#1365275 — Re: [PATCH] Drivers: isdn: hisax: isac.c: Fix assignment and check into one expression.

FromDavid Miller <davem@davemloft.net>
Date2016-03-28 04:50 +0200
SubjectRe: [PATCH] Drivers: isdn: hisax: isac.c: Fix assignment and check into one expression.
Message-ID<rhvpD-Dg-9@gated-at.bofh.it>
In reply to#1364889
From: Cosmin-Gabriel Samoila <gabrielcsmo@gmail.com>
Date: Sat, 26 Mar 2016 02:49:50 +0200

> Fix variable assignment inside if statement. It is error-prone and hard to read.
> 
> Signed-off-by: Cosmin-Gabriel Samoila <gabrielcsmo@gmail.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web