From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Colin King <colin.king@canonical.com>
Cc: Richard Weinberger <richard@nod.at>,
kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] mtd: rawnand: qcom: fix incorrect masking operator, used & instead of |
Date: Tue, 16 Jun 2020 12:57:56 +0000 [thread overview]
Message-ID: <20200616145756.4875d0c6@xps13> (raw)
In-Reply-To: <20200616115125.74298-1-colin.king@canonical.com>
Hi Colin,
Colin King <colin.king@canonical.com> wrote on Tue, 16 Jun 2020
12:51:25 +0100:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the expression (nand_ctrl | BAM_MODE_EN) is always true no
> matter the value of nand_ctrl because the incorrect masking operator
> is being used. Fix this by using bit-wise & instead of |.
I saw it when reviewing and marked it to solve before applying but it
looks like I forgot to do so. If you don't mind I'll merge this with
the original commit.
>
> Addresses-Coverity: ("Wrong operator used")
> Fixes: dd0c1fc8de12 ("mtd: rawnand: qcom: set BAM mode only if not set already")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/mtd/nand/raw/qcom_nandc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
> index a3ef4288be27..37d95532ba7e 100644
> --- a/drivers/mtd/nand/raw/qcom_nandc.c
> +++ b/drivers/mtd/nand/raw/qcom_nandc.c
> @@ -2790,7 +2790,7 @@ static int qcom_nandc_setup(struct qcom_nand_controller *nandc)
> * only if it is not in BAM mode. In most cases BAM
> * mode will be enabled in bootloader
> */
> - if (!(nand_ctrl | BAM_MODE_EN))
> + if (!(nand_ctrl & BAM_MODE_EN))
> nandc_write(nandc, NAND_CTRL, nand_ctrl | BAM_MODE_EN);
> } else {
> nandc_write(nandc, NAND_FLASH_CHIP_SELECT, DM_EN);
Thanks,
Miquèl
next prev parent reply other threads:[~2020-06-16 12:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 11:51 [PATCH][next] mtd: rawnand: qcom: fix incorrect masking operator, used & instead of | Colin King
2020-06-16 12:57 ` Miquel Raynal [this message]
2020-06-16 13:04 ` Colin Ian King
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=20200616145756.4875d0c6@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=colin.king@canonical.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
/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).