Skip to contentSkip to conversation

Staging: comedi: driver: Remove condition with no effect

PATCH In review Saurav Girepunje 3 participants 4 messages Jul 12, 2020 – Jul 18, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: comedi: driver: Remove condition with no effect

Remove below warning in das1800.c
WARNING: possible condition with no effect (if == else)

---
 drivers/staging/comedi/drivers/das1800.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/comedi/drivers/das1800.c +0 -6
index f16aa7e9f4f3..7ab72e83d3d0 100644
@@ -1299,12 +1299,6 @@ static int das1800_attach(struct comedi_device *dev,
 			outb(DAC(i), dev->iobase + DAS1800_SELECT);
 			outw(0, dev->iobase + DAS1800_DAC);
 		}
-	} else if (board->id == DAS1800_ID_AO) {
-		/*
-		 * 'ao' boards have waveform analog outputs that are not
-		 * currently supported.
-		 */
-		s->type		= COMEDI_SUBD_UNUSED;
 	} else {
 		s->type		= COMEDI_SUBD_UNUSED;
 	}
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 13 lines · Saurav Girepunje

Remove below warning in das1800.c
WARNING: possible condition with no effect (if == else)

---
 drivers/staging/comedi/drivers/das1800.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/comedi/drivers/das1800.c +0 -0
index f16aa7e9f4f3..7ab72e83d3d0 100644

drivers/staging/comedi/drivers/das1800.c static int das1800_attach(struct comedi_device *dev, · line 1307

Quoted 9 lines
drivers/staging/comedi/drivers/das1800.c +0 -6
@@ -1299,12 +1299,6 @@ static int das1800_attach(struct comedi_device *dev,
 			outb(DAC(i), dev->iobase + DAS1800_SELECT);
 			outw(0, dev->iobase + DAS1800_DAC);
 		}
-	} else if (board->id == DAS1800_ID_AO) {
-		/*
-		 * 'ao' boards have waveform analog outputs that are not
-		 * currently supported.
-		 */
-		s->type		= COMEDI_SUBD_UNUSED;

What gave that warning? The comment should show you why this is good to keep as-is, right?

thanks,

greg k-h

#2 lore raw
Quoted 18 lines · Greg KH
Quoted 17 lines · Saurav Girepunje

Remove below warning in das1800.c
WARNING: possible condition with no effect (if == else)

---
  drivers/staging/comedi/drivers/das1800.c | 6 ------
  1 file changed, 6 deletions(-)
drivers/staging/comedi/drivers/das1800.c +0 -1
index f16aa7e9f4f3..7ab72e83d3d0 100644
@@ -1299,12 +1299,6 @@ static int das1800_attach(struct comedi_device *dev,
  			outb(DAC(i), dev->iobase + DAS1800_SELECT);
  			outw(0, dev->iobase + DAS1800_DAC);
  		}
-	} else if (board->id == DAS1800_ID_AO) {
Quoted 8 lines

drivers/staging/comedi/drivers/das1800.c static int das1800_attach(struct comedi_device *dev, · line 1307

Quoted 5 lines
drivers/staging/comedi/drivers/das1800.c +0 -5
-		/*
-		 * 'ao' boards have waveform analog outputs that are not
-		 * currently supported.
-		 */
-		s->type		= COMEDI_SUBD_UNUSED;

What gave that warning? The comment should show you why this is good to keep as-is, right?

One option is to move the comment into the '} else {' part that follows this part.

Signature · 4 lines
-=( Ian Abbott <[email protected]> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
#3 lore raw
Quoted 28 lines · Ian Abbott
Quoted 18 lines · Greg KH
Quoted 17 lines · Saurav Girepunje

Remove below warning in das1800.c
WARNING: possible condition with no effect (if == else)

---
  drivers/staging/comedi/drivers/das1800.c | 6 ------
  1 file changed, 6 deletions(-)
drivers/staging/comedi/drivers/das1800.c +0 -1
index f16aa7e9f4f3..7ab72e83d3d0 100644
@@ -1299,12 +1299,6 @@ static int das1800_attach(struct comedi_device *dev,
  			outb(DAC(i), dev->iobase + DAS1800_SELECT);
  			outw(0, dev->iobase + DAS1800_DAC);
  		}
-	} else if (board->id == DAS1800_ID_AO) {
Quoted 8 lines

drivers/staging/comedi/drivers/das1800.c static int das1800_attach(struct comedi_device *dev, · line 1307

Quoted 5 lines
drivers/staging/comedi/drivers/das1800.c +0 -5
-		/*
-		 * 'ao' boards have waveform analog outputs that are not
-		 * currently supported.
-		 */
-		s->type		= COMEDI_SUBD_UNUSED;

What gave that warning? The comment should show you why this is good to keep as-is, right?

Quoted 8 lines

One option is to move the comment into the '} else {' part that follows this part.

Signature · 4 lines
-=( Ian Abbott <[email protected]> || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:    )=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-

@gregkh : Got the warning using coccinelle.
@Ian: Yes, we can move comment to else part.