From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <ardeleanalex@gmail.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH] iio: kfifo: mask flags without zero-check in devm_iio_kfifo_buffer_setup()
Date: Sun, 7 Mar 2021 12:29:44 +0000 [thread overview]
Message-ID: <20210307122944.2276f633@archlinux> (raw)
In-Reply-To: <20210306162834.7339-1-ardeleanalex@gmail.com>
On Sat, 6 Mar 2021 18:28:34 +0200
Alexandru Ardelean <ardeleanalex@gmail.com> wrote:
> 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: ae9886d6aa29 ("iio: kfifo: add devm_iio_kfifo_buffer_setup() helper")
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
I've applied this as a separate patch. Thanks,
Jonathan
> ---
>
> Apologies for the late-ness of this.
> I don't know if this makes sense to squash in the original, or to have
> as a fix commit.
> It is a bit messy now that the original is committed into the tree,
> and now we're fixing/tweaking it.
>
> drivers/iio/buffer/kfifo_buf.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/buffer/kfifo_buf.c b/drivers/iio/buffer/kfifo_buf.c
> index e8a434f84778..8e3a1a9e495c 100644
> --- a/drivers/iio/buffer/kfifo_buf.c
> +++ b/drivers/iio/buffer/kfifo_buf.c
> @@ -275,9 +275,6 @@ int devm_iio_kfifo_buffer_setup(struct device *dev,
> {
> struct iio_buffer *buffer;
>
> - if (mode_flags)
> - mode_flags &= kfifo_access_funcs.modes;
> -
> if (!mode_flags)
> return -EINVAL;
>
> @@ -285,6 +282,8 @@ int devm_iio_kfifo_buffer_setup(struct device *dev,
> if (!buffer)
> return -ENOMEM;
>
> + mode_flags &= kfifo_access_funcs.modes;
> +
> indio_dev->modes |= mode_flags;
> indio_dev->setup_ops = setup_ops;
>
prev parent reply other threads:[~2021-03-07 12:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-06 16:28 [PATCH] iio: kfifo: mask flags without zero-check in devm_iio_kfifo_buffer_setup() Alexandru Ardelean
2021-03-07 12:29 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210307122944.2276f633@archlinux \
--to=jic23@kernel.org \
--cc=ardeleanalex@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.