Skip to contentSkip to conversation

Staging: fwserial: remove unnecessary parenthesis

PATCH In review Quytelda Kahja 3 participants 3 messages Feb 1, 2018 – Feb 2, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: fwserial: remove unnecessary parenthesis

Removed parenthesis causing a coding style warning.

---
 drivers/staging/fwserial/dma_fifo.c | 2 +-
 drivers/staging/fwserial/fwserial.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/fwserial/dma_fifo.c +1 -1
index 8b23a553fd4a..ead71f93f3c9 100644
@@ -259,7 +259,7 @@ int dma_fifo_out_complete(struct dma_fifo *fifo, struct dma_pending *complete)
 	if (list_empty(&fifo->pending) && fifo->open == 0)
 		return -EINVAL;
 
-	if (FAIL(fifo, list_empty(&fifo->pending) != (fifo->open == 0),
+	if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
 		 "pending list disagrees with open count:%d",
 		 fifo->open))
 		return -ENXIO;
drivers/staging/fwserial/fwserial.c +1 -1
index bba7e9c888b3..99cdefc873e5 100644
@@ -1296,7 +1296,7 @@ static void fwtty_set_termios(struct tty_struct *tty, struct ktermios *old)
 	spin_lock_bh(&port->lock);
 	baud = set_termios(port, tty);
 
-	if ((baud == 0) && (old->c_cflag & CBAUD)) {
+	if (baud == 0 && (old->c_cflag & CBAUD)) {
 		port->mctrl &= ~(TIOCM_DTR | TIOCM_RTS);
 	} else if ((baud != 0) && !(old->c_cflag & CBAUD)) {
 		if (C_CRTSCTS(tty) || !tty_throttled(tty))
Signature · 1 line
2.16.1
#1 lore raw
Quoted 13 lines · Quytelda Kahja

Removed parenthesis causing a coding style warning.

---
 drivers/staging/fwserial/dma_fifo.c | 2 +-
 drivers/staging/fwserial/fwserial.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/fwserial/dma_fifo.c +0 -0
index 8b23a553fd4a..ead71f93f3c9 100644

drivers/staging/fwserial/dma_fifo.c int dma_fifo_out_complete(struct dma_fifo *fifo, struct dma_pending *complete) · line 262

Quoted 5 lines
drivers/staging/fwserial/dma_fifo.c +1 -1
@@ -259,7 +259,7 @@ int dma_fifo_out_complete(struct dma_fifo *fifo, struct dma_pending *complete)
 	if (list_empty(&fifo->pending) && fifo->open == 0)
 		return -EINVAL;
 
-	if (FAIL(fifo, list_empty(&fifo->pending) != (fifo->open == 0),
+	if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,

No no no... You've changed what the code does here... I'm so surprised the compiler doesn't complain.

regards,
dan carpenter

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

#2 lore raw
In reply to Quytelda Kahja
Thank you for the patch! Perhaps something to improve:

Hi Quytelda,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.15 next-20180201]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Quytelda-Kahja/Staging-fwserial-remove-unnecessary-parenthesis/20180202-093148
config: i386-randconfig-x019-201804 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025 reproduce:

        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:10:0,
from drivers/staging//fwserial/dma_fifo.c:8:
drivers/staging//fwserial/dma_fifo.c: In function 'dma_fifo_out_complete':

>> drivers/staging//fwserial/dma_fifo.c:253:44: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
     if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/staging//fwserial/dma_fifo.c:253:2: note: in expansion of macro 'if'
     if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
     ^~
>> drivers/staging//fwserial/dma_fifo.c:253:6: note: in expansion of macro 'FAIL'
     if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
         ^~~~
>> drivers/staging//fwserial/dma_fifo.c:253:44: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
     if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/staging//fwserial/dma_fifo.c:253:2: note: in expansion of macro 'if'
     if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
     ^~
>> drivers/staging//fwserial/dma_fifo.c:253:6: note: in expansion of macro 'FAIL'
     if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
         ^~~~
>> drivers/staging//fwserial/dma_fifo.c:253:44: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
     if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/staging//fwserial/dma_fifo.c:253:2: note: in expansion of macro 'if'
     if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
     ^~
>> drivers/staging//fwserial/dma_fifo.c:253:6: note: in expansion of macro 'FAIL'
     if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,
         ^~~~

vim +253 drivers/staging//fwserial/dma_fifo.c

236
237 /**
238 * dma_fifo_out_complete - marks pended dma as completed
239 * @fifo: address of in-place "struct dma_fifo" which was read from
240 * @complete: address of structure for previously pended dma to mark completed
241 */
242 int dma_fifo_out_complete(struct dma_fifo *fifo, struct dma_pending *complete)
243 {
244 struct dma_pending *pending, *next, *tmp;
245
246 if (!fifo->data)
247 return -ENOENT;
248 if (fifo->corrupt)
249 return -ENXIO;
250 if (list_empty(&fifo->pending) && fifo->open == 0)
251 return -EINVAL;
252

 > 253		if (FAIL(fifo, list_empty(&fifo->pending) != fifo->open == 0,

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation