All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] mtd: rawnand: qcom: fix incorrect masking operator, used & instead of |
@ 2020-06-16 11:51 ` Colin King
  0 siblings, 0 replies; 9+ messages in thread
From: Colin King @ 2020-06-16 11:51 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, linux-mtd
  Cc: kernel-janitors, linux-kernel

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 |.

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);
-- 
2.27.0.rc0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-06-16 13:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 11:51 [PATCH][next] mtd: rawnand: qcom: fix incorrect masking operator, used & instead of | Colin King
2020-06-16 11:51 ` Colin King
2020-06-16 11:51 ` Colin King
2020-06-16 12:57 ` Miquel Raynal
2020-06-16 12:57   ` Miquel Raynal
2020-06-16 12:57   ` Miquel Raynal
2020-06-16 13:04   ` Colin Ian King
2020-06-16 13:04     ` Colin Ian King
2020-06-16 13:04     ` Colin Ian King

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.