[PATCH 09/11] staging: dgap: fix do not use assignment in if condition as reported by checkpatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes "do not use assignment in if condition"
errors reported by checkpatch

Signed-off-by: Mark Hounschell <markh@xxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/dgap/dgap.c | 75 ++++++++++++++++++++++++++++++---------------
 1 file changed, 50 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index bbe60c7..b432d53 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -2870,7 +2870,8 @@ static int dgap_tty_write(struct tty_struct *tty, const unsigned char *buf, int
 	head = readw(&(bs->tx_head)) & tmask;
 	tail = readw(&(bs->tx_tail)) & tmask;
 
-	if ((bufcount = tail - head - 1) < 0)
+	bufcount = tail - head - 1;
+	if (bufcount < 0)
 		bufcount += ch->ch_tsize;
 
 	/*
@@ -6720,7 +6721,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case BOARD:	/* board info */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(BNODE)) == NULL) {
+			p->next = dgap_newnode(BNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7020,16 +7022,19 @@ static int	dgap_parsefile(char **in, int Remove)
 		case TTYN:	/* tty name prefix */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(TNODE)) == NULL) {
+			p->next = dgap_newnode(TNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
 			p = p->next;
-			if ((s = dgap_getword(in)) == NULL) {
+			s = dgap_getword(in);
+			if (!s) {
 				dgap_err("unexpeced end of file");
 				return -1;
 			}
-			if ((p->u.ttyname = dgap_savestring(s)) == NULL) {
+			p->u.ttyname = dgap_savestring(s);
+			if (!p->u.ttyname) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7038,16 +7043,19 @@ static int	dgap_parsefile(char **in, int Remove)
 		case CU:	/* cu name prefix */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(CUNODE)) == NULL) {
+			p->next = dgap_newnode(CUNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
 			p = p->next;
-			if ((s = dgap_getword(in)) == NULL) {
+			s = dgap_getword(in);
+			if (!s) {
 				dgap_err("unexpeced end of file");
 				return -1;
 			}
-			if ((p->u.cuname = dgap_savestring(s)) == NULL) {
+			p->u.cuname = dgap_savestring(s);
+			if (!p->u.cuname) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7065,7 +7073,8 @@ static int	dgap_parsefile(char **in, int Remove)
 				dgap_err("line not vaild for PC/em");
 				return -1;
 			}
-			if ((p->next = dgap_newnode(LNODE)) == NULL) {
+			p->next = dgap_newnode(LNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7082,7 +7091,8 @@ static int	dgap_parsefile(char **in, int Remove)
 				dgap_err("must specify line info before concentrator");
 				return -1;
 			}
-			if ((p->next = dgap_newnode(CNODE)) == NULL) {
+			p->next = dgap_newnode(CNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7130,7 +7140,8 @@ static int	dgap_parsefile(char **in, int Remove)
 					return -1;
 				}
 			}
-			if ((p->next = dgap_newnode(MNODE)) == NULL) {
+			p->next = dgap_newnode(MNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7162,7 +7173,8 @@ static int	dgap_parsefile(char **in, int Remove)
 
 		case CABLE:
 			if (p->type == LNODE) {
-				if ((s = dgap_getword(in)) == NULL) {
+				s = dgap_getword(in);
+				if (!s) {
 					dgap_err("unexpected end of file");
 					return -1;
 				}
@@ -7204,7 +7216,8 @@ static int	dgap_parsefile(char **in, int Remove)
 
 		case CONNECT:
 			if (p->type == CNODE) {
-				if ((s = dgap_getword(in)) == NULL) {
+				s = dgap_getword(in);
+				if (!s) {
 					dgap_err("unexpected end of file");
 					return -1;
 				}
@@ -7215,16 +7228,19 @@ static int	dgap_parsefile(char **in, int Remove)
 		case PRINT:	/* transparent print name prefix */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(PNODE)) == NULL) {
+			p->next = dgap_newnode(PNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
 			p = p->next;
-			if ((s = dgap_getword(in)) == NULL) {
+			s = dgap_getword(in);
+			if (!s) {
 				dgap_err("unexpeced end of file");
 				return -1;
 			}
-			if ((p->u.printname = dgap_savestring(s)) == NULL) {
+			p->u.printname = dgap_savestring(s);
+			if (!p->u.printname) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7233,7 +7249,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case CMAJOR:	/* major number */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(JNODE)) == NULL) {
+			p->next = dgap_newnode(JNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7253,7 +7270,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case ALTPIN:	/* altpin setting */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(ANODE)) == NULL) {
+			p->next = dgap_newnode(ANODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7273,7 +7291,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case USEINTR:		/* enable interrupt setting */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(INTRNODE)) == NULL) {
+			p->next = dgap_newnode(INTRNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7293,7 +7312,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case TTSIZ:	/* size of tty structure */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(TSNODE)) == NULL) {
+			p->next = dgap_newnode(TSNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7313,7 +7333,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case CHSIZ:	/* channel structure size */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(CSNODE)) == NULL) {
+			p->next = dgap_newnode(CSNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7333,7 +7354,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case BSSIZ:	/* board structure size */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(BSNODE)) == NULL) {
+			p->next = dgap_newnode(BSNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7353,7 +7375,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case UNTSIZ:	/* sched structure size */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(USNODE)) == NULL) {
+			p->next = dgap_newnode(USNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7373,7 +7396,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case F2SIZ:	/* f2200 structure size */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(FSNODE)) == NULL) {
+			p->next = dgap_newnode(FSNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
@@ -7393,7 +7417,8 @@ static int	dgap_parsefile(char **in, int Remove)
 		case VPSIZ:	/* vpix structure size */
 			if (dgap_checknode(p))
 				return -1;
-			if ((p->next = dgap_newnode(VSNODE)) == NULL) {
+			p->next = dgap_newnode(VSNODE);
+			if (!p->next) {
 				dgap_err("out of memory");
 				return -1;
 			}
-- 
1.8.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux