public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* re: iio: ltr501: Add interrupt support
@ 2015-05-12 18:09 Dan Carpenter
  2015-05-12 20:56 ` sathyanarayanan kuppuswamy
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-05-12 18:09 UTC (permalink / raw)
  To: sathyanarayanan.kuppuswamy; +Cc: linux-iio

Hello Kuppuswamy Sathyanarayanan,

The patch 7ac702b3144b: "iio: ltr501: Add interrupt support" from Apr
19, 2015, leads to the following static checker warning:

	drivers/iio/light/ltr501.c:869 ltr501_write_thresh()
	info: ignoring unreachable code.

drivers/iio/light/ltr501.c
   867          case IIO_PROXIMITY:
   868                  switch (dir) {
   869                  if (val > LTR501_PS_THRESH_MASK)
   870                          return -EINVAL;

Probably this code should be outside of this switch (dir) statement?

   871                  case IIO_EV_DIR_RISING:
   872                          mutex_lock(&data->lock_ps);
   873                          ret = regmap_bulk_write(data->regmap,
   874                                                  LTR501_PS_THRESH_UP,
   875                                                  &val, 2);
   876                          mutex_unlock(&data->lock_ps);
   877                          return ret;
   878                  case IIO_EV_DIR_FALLING:
   879                          mutex_lock(&data->lock_ps);
   880                          ret = regmap_bulk_write(data->regmap,
   881                                                  LTR501_PS_THRESH_LOW,
   882                                                  &val, 2);
   883                          mutex_unlock(&data->lock_ps);
   884                          return ret;
   885                  default:
   886                          return -EINVAL;
   887                  }
   888          default:
   889                  return -EINVAL;
   890          }
   891  
   892          return -EINVAL;
   893  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: iio: ltr501: Add interrupt support
  2015-05-12 18:09 iio: ltr501: Add interrupt support Dan Carpenter
@ 2015-05-12 20:56 ` sathyanarayanan kuppuswamy
  0 siblings, 0 replies; 2+ messages in thread
From: sathyanarayanan kuppuswamy @ 2015-05-12 20:56 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-iio

Hi

On 05/12/2015 11:09 AM, Dan Carpenter wrote:
> Hello Kuppuswamy Sathyanarayanan,
>
> The patch 7ac702b3144b: "iio: ltr501: Add interrupt support" from Apr
> 19, 2015, leads to the following static checker warning:
>
> 	drivers/iio/light/ltr501.c:869 ltr501_write_thresh()
> 	info: ignoring unreachable code.
>
> drivers/iio/light/ltr501.c
>     867          case IIO_PROXIMITY:
>     868                  switch (dir) {
>     869                  if (val > LTR501_PS_THRESH_MASK)
>     870                          return -EINVAL;
>
> Probably this code should be outside of this switch (dir) statement?
Agreed. I will send a patch with fix soon.
>
>     871                  case IIO_EV_DIR_RISING:
>     872                          mutex_lock(&data->lock_ps);
>     873                          ret = regmap_bulk_write(data->regmap,
>     874                                                  LTR501_PS_THRESH_UP,
>     875                                                  &val, 2);
>     876                          mutex_unlock(&data->lock_ps);
>     877                          return ret;
>     878                  case IIO_EV_DIR_FALLING:
>     879                          mutex_lock(&data->lock_ps);
>     880                          ret = regmap_bulk_write(data->regmap,
>     881                                                  LTR501_PS_THRESH_LOW,
>     882                                                  &val, 2);
>     883                          mutex_unlock(&data->lock_ps);
>     884                          return ret;
>     885                  default:
>     886                          return -EINVAL;
>     887                  }
>     888          default:
>     889                  return -EINVAL;
>     890          }
>     891
>     892          return -EINVAL;
>     893  }
>
> regards,
> dan carpenter
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

-- 
Sathyanarayanan Kuppuswamy
Android kernel developer


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-12 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12 18:09 iio: ltr501: Add interrupt support Dan Carpenter
2015-05-12 20:56 ` sathyanarayanan kuppuswamy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox