From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: hemantk@codeaurora.org, jhugo@codeaurora.org
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
smohanad@codeaurora.org, dan.carpenter@oracle.com,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Subject: [PATCH 1/2] bus: mhi: core: Fix parsing of mhi_flags
Date: Mon, 13 Apr 2020 17:37:40 +0530 [thread overview]
Message-ID: <20200413120741.2832-1-manivannan.sadhasivam@linaro.org> (raw)
With the current parsing of mhi_flags, the following statement always
return false:
eob = !!(flags & MHI_EOB);
This is due to the fact that 'enum mhi_flags' starts with index 0 and we
are using direct AND operation to extract each bit. Fix this by using
BIT() macro to extract each bit and make the mhi_flags index start from 1.
Fixes: 189ff97cca53 ("bus: mhi: core: Add support for data transfer")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/bus/mhi/core/main.c | 6 +++---
include/linux/mhi.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
index eb4256b81406..4165a853c189 100644
--- a/drivers/bus/mhi/core/main.c
+++ b/drivers/bus/mhi/core/main.c
@@ -1090,9 +1090,9 @@ int mhi_gen_tre(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan,
if (ret)
return ret;
- eob = !!(flags & MHI_EOB);
- eot = !!(flags & MHI_EOT);
- chain = !!(flags & MHI_CHAIN);
+ eob = !!(flags & BIT(0));
+ eot = !!(flags & BIT(1));
+ chain = !!(flags & BIT(2));
bei = !!(mhi_chan->intmod);
mhi_tre = tre_ring->wp;
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index ad1996001965..22185fecbbf2 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -53,7 +53,7 @@ enum mhi_callback {
* @MHI_CHAIN: Linked transfer
*/
enum mhi_flags {
- MHI_EOB,
+ MHI_EOB = 1,
MHI_EOT,
MHI_CHAIN,
};
--
2.17.1
next reply other threads:[~2020-04-13 12:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-13 12:07 Manivannan Sadhasivam [this message]
2020-04-13 12:07 ` [PATCH 2/2] bus: mhi: core: Fix double lock of 'mhi_chan->lock' Manivannan Sadhasivam
2020-04-16 19:01 ` [PATCH 1/2] bus: mhi: core: Fix parsing of mhi_flags Hemant Kumar
2020-04-17 10:19 ` Manivannan Sadhasivam
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=20200413120741.2832-1-manivannan.sadhasivam@linaro.org \
--to=manivannan.sadhasivam@linaro.org \
--cc=dan.carpenter@oracle.com \
--cc=hemantk@codeaurora.org \
--cc=jhugo@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=smohanad@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).