Commit bbc1308d authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron

iio: kfifo: mask flags without zero-check in devm_iio_kfifo_buffer_setup()

As pointed by Lars, this doesn't require a zero-check. Also, while looking
at this a little closer at it (again), the masking can be done later, as
there is a zero-check for 'mode_flags' anyway, which returns -EINVAL. And
we only need the 'mode_flags' later in the logic.

This change is more of a tweak.

Fixes: e36db6a0 ("iio: kfifo: add devm_iio_kfifo_buffer_setup() helper")
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20210306162834.7339-1-ardeleanalex@gmail.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent dafcf4ed
...@@ -225,9 +225,6 @@ int devm_iio_kfifo_buffer_setup(struct device *dev, ...@@ -225,9 +225,6 @@ int devm_iio_kfifo_buffer_setup(struct device *dev,
{ {
struct iio_buffer *buffer; struct iio_buffer *buffer;
if (mode_flags)
mode_flags &= kfifo_access_funcs.modes;
if (!mode_flags) if (!mode_flags)
return -EINVAL; return -EINVAL;
...@@ -235,6 +232,8 @@ int devm_iio_kfifo_buffer_setup(struct device *dev, ...@@ -235,6 +232,8 @@ int devm_iio_kfifo_buffer_setup(struct device *dev,
if (!buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
mode_flags &= kfifo_access_funcs.modes;
indio_dev->modes |= mode_flags; indio_dev->modes |= mode_flags;
indio_dev->setup_ops = setup_ops; indio_dev->setup_ops = setup_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment