All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] iio: ltr501: Fix proximity threshold boundary check
@ 2015-05-15 23:42 ` Kuppuswamy Sathyanarayanan
  0 siblings, 0 replies; 4+ messages in thread
From: Kuppuswamy Sathyanarayanan @ 2015-05-15 23:42 UTC (permalink / raw)
  To: jic23, pmeerw
  Cc: srinivas.pandruvada, sathyanarayanan.kuppuswamy, linux-kernel, linux-iio

Currently, proximity sensor boundary check is done
inside the switch block but outside the case
statement.Since this code will never get executed,
moved the check outside the switch case statement.

   867          case IIO_PROXIMITY:
   868                  switch (dir) {
   // Following line has been moved outside the switch block.
   869                  if (val > LTR501_PS_THRESH_MASK)
   870                          return -EINVAL;
   871                  case IIO_EV_DIR_RISING:

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
 drivers/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index ca4bf47..417369b 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -865,9 +865,9 @@ static int ltr501_write_thresh(struct iio_dev *indio_dev,
 			return -EINVAL;
 		}
 	case IIO_PROXIMITY:
-		switch (dir) {
 		if (val > LTR501_PS_THRESH_MASK)
 			return -EINVAL;
+		switch (dir) {
 		case IIO_EV_DIR_RISING:
 			mutex_lock(&data->lock_ps);
 			ret = regmap_bulk_write(data->regmap,
-- 
1.9.1


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

* [PATCH v1 1/1] iio: ltr501: Fix proximity threshold boundary check
@ 2015-05-15 23:42 ` Kuppuswamy Sathyanarayanan
  0 siblings, 0 replies; 4+ messages in thread
From: Kuppuswamy Sathyanarayanan @ 2015-05-15 23:42 UTC (permalink / raw)
  To: jic23, pmeerw
  Cc: srinivas.pandruvada, sathyanarayanan.kuppuswamy, linux-kernel, linux-iio

Currently, proximity sensor boundary check is done
inside the switch block but outside the case
statement.Since this code will never get executed,
moved the check outside the switch case statement.

   867          case IIO_PROXIMITY:
   868                  switch (dir) {
   // Following line has been moved outside the switch block.
   869                  if (val > LTR501_PS_THRESH_MASK)
   870                          return -EINVAL;
   871                  case IIO_EV_DIR_RISING:

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
 drivers/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index ca4bf47..417369b 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -865,9 +865,9 @@ static int ltr501_write_thresh(struct iio_dev *indio_dev,
 			return -EINVAL;
 		}
 	case IIO_PROXIMITY:
-		switch (dir) {
 		if (val > LTR501_PS_THRESH_MASK)
 			return -EINVAL;
+		switch (dir) {
 		case IIO_EV_DIR_RISING:
 			mutex_lock(&data->lock_ps);
 			ret = regmap_bulk_write(data->regmap,
-- 
1.9.1


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

* Re: [PATCH v1 1/1] iio: ltr501: Fix proximity threshold boundary check
  2015-05-15 23:42 ` Kuppuswamy Sathyanarayanan
@ 2015-05-16 10:09   ` Jonathan Cameron
  -1 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2015-05-16 10:09 UTC (permalink / raw)
  To: Kuppuswamy Sathyanarayanan, pmeerw
  Cc: srinivas.pandruvada, linux-kernel, linux-iio

On 16/05/15 00:42, Kuppuswamy Sathyanarayanan wrote:
> Currently, proximity sensor boundary check is done
> inside the switch block but outside the case
> statement.Since this code will never get executed,
> moved the check outside the switch case statement.
> 
>    867          case IIO_PROXIMITY:
>    868                  switch (dir) {
>    // Following line has been moved outside the switch block.
>    869                  if (val > LTR501_PS_THRESH_MASK)
>    870                          return -EINVAL;
>    871                  case IIO_EV_DIR_RISING:
> 
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Applied to the togreg branch of iio.git

Thanks,

Jonathan
> ---
>  drivers/iio/light/ltr501.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> index ca4bf47..417369b 100644
> --- a/drivers/iio/light/ltr501.c
> +++ b/drivers/iio/light/ltr501.c
> @@ -865,9 +865,9 @@ static int ltr501_write_thresh(struct iio_dev *indio_dev,
>  			return -EINVAL;
>  		}
>  	case IIO_PROXIMITY:
> -		switch (dir) {
>  		if (val > LTR501_PS_THRESH_MASK)
>  			return -EINVAL;
> +		switch (dir) {
>  		case IIO_EV_DIR_RISING:
>  			mutex_lock(&data->lock_ps);
>  			ret = regmap_bulk_write(data->regmap,
> 


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

* Re: [PATCH v1 1/1] iio: ltr501: Fix proximity threshold boundary check
@ 2015-05-16 10:09   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2015-05-16 10:09 UTC (permalink / raw)
  To: Kuppuswamy Sathyanarayanan, pmeerw
  Cc: srinivas.pandruvada, linux-kernel, linux-iio

On 16/05/15 00:42, Kuppuswamy Sathyanarayanan wrote:
> Currently, proximity sensor boundary check is done
> inside the switch block but outside the case
> statement.Since this code will never get executed,
> moved the check outside the switch case statement.
> 
>    867          case IIO_PROXIMITY:
>    868                  switch (dir) {
>    // Following line has been moved outside the switch block.
>    869                  if (val > LTR501_PS_THRESH_MASK)
>    870                          return -EINVAL;
>    871                  case IIO_EV_DIR_RISING:
> 
> Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Applied to the togreg branch of iio.git

Thanks,

Jonathan
> ---
>  drivers/iio/light/ltr501.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> index ca4bf47..417369b 100644
> --- a/drivers/iio/light/ltr501.c
> +++ b/drivers/iio/light/ltr501.c
> @@ -865,9 +865,9 @@ static int ltr501_write_thresh(struct iio_dev *indio_dev,
>  			return -EINVAL;
>  		}
>  	case IIO_PROXIMITY:
> -		switch (dir) {
>  		if (val > LTR501_PS_THRESH_MASK)
>  			return -EINVAL;
> +		switch (dir) {
>  		case IIO_EV_DIR_RISING:
>  			mutex_lock(&data->lock_ps);
>  			ret = regmap_bulk_write(data->regmap,
> 


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

end of thread, other threads:[~2015-05-16 10:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-15 23:42 [PATCH v1 1/1] iio: ltr501: Fix proximity threshold boundary check Kuppuswamy Sathyanarayanan
2015-05-15 23:42 ` Kuppuswamy Sathyanarayanan
2015-05-16 10:09 ` Jonathan Cameron
2015-05-16 10:09   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.