lkml.org 
[lkml]   [2021]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/4] iio: proximity: vcnl3020: add threshold options
On Fri, Apr 30, 2021 at 6:16 PM Ivan Mikhaylov <i.mikhaylov@yadro.com> wrote:
>
> Add the low/high threshold options.

...

> + rc = regmap_bulk_read(data->regmap, VCNL_PS_HI_THR_HI,
> + &res, 2);

sizeof(res)

> + *val = be16_to_cpu(res);

So, the rule of thumb is not putting anything to the output, until you
know that there is no error.

> + if (rc < 0)
> + return rc;

...

> + rc = regmap_bulk_read(data->regmap, VCNL_PS_LO_THR_HI,
> + &res, 2);
> + *val = be16_to_cpu(res);
> + if (rc < 0)
> + return rc;

As per above.

...

> + rc = regmap_bulk_write(data->regmap, VCNL_PS_HI_THR_HI,
> + &buf, 2);

sizeof(buf) ?

...

> + rc = regmap_bulk_write(data->regmap, VCNL_PS_LO_THR_HI,
> + &buf, 2);

Ditto.

...

> +end:

out_release_direct_mode:

> + iio_device_release_direct_mode(indio_dev);
> + return rc;

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-05-01 20:53    [W:0.128 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site