Re: [PATCH 15/15] staging: comedi: s626: remove unnecessary 'cmd' pointer checks

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

 



On 04/03/15 19:15, H Hartley Sweeten wrote:
The local variable 'cmd' is a pointer to the address of a member variable
of a struct. It will always be valid. Remove the unnecessary checks.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
  drivers/staging/comedi/drivers/s626.c | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
index fc497dd..422ea9c 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1576,7 +1576,7 @@ static void s626_reset_adc(struct comedi_device *dev, uint8_t *ppl)
  	       dev->mmio + S626_P_RPSADDR1);

  	/* Construct RPS program in rps_buf DMA buffer */
-	if (cmd != NULL && cmd->scan_begin_src != TRIG_FOLLOW) {
+	if (cmd->scan_begin_src != TRIG_FOLLOW) {
  		/* Wait for Start trigger. */
  		*rps++ = S626_RPS_PAUSE | S626_RPS_SIGADC;
  		*rps++ = S626_RPS_CLRSIGNAL | S626_RPS_SIGADC;
@@ -1665,7 +1665,7 @@ static void s626_reset_adc(struct comedi_device *dev, uint8_t *ppl)
  			*rps++ = jmp_adrs;
  		}

-		if (cmd != NULL && cmd->convert_src != TRIG_NOW) {
+		if (cmd->convert_src != TRIG_NOW) {
  			/* Wait for Start trigger. */
  			*rps++ = S626_RPS_PAUSE | S626_RPS_SIGADC;
  			*rps++ = S626_RPS_CLRSIGNAL | S626_RPS_SIGADC;
@@ -2034,10 +2034,6 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
  	/* reset ai_cmd_running flag */
  	devpriv->ai_cmd_running = 0;

-	/* test if cmd is valid */
-	if (cmd == NULL)
-		return -EINVAL;
-
  	s626_ai_load_polllist(ppl, cmd);
  	devpriv->ai_cmd_running = 1;
  	devpriv->ai_convert_count = 0;


Just a remark... s626_initialize() has some '#if 0'-disabled code that calls s626_reset_adc() before s->async (and its 'cmd' member) has been allocated, so that should really be removed!

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx> )=-
-=(                          Web: http://www.mev.co.uk/  )=-
_______________________________________________
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