linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "B. Niedermayr" <benedikt.niedermayr@siemens.com>
To: <linux-next@vger.kernel.org>, Roger Quadros <rogerq@kernel.org>,
	"Tony Lindgren" <tony@atomide.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	"open list:OMAP GENERAL PURPOSE MEMORY CONTROLLER SUPPORT" 
	<linux-omap@vger.kernel.org>,
	"open list:MEMORY CONTROLLER DRIVERS"
	<linux-kernel@vger.kernel.org>
Subject: [PATCH] memory: omap-gpmc: fix wait pin validation
Date: Fri, 9 Dec 2022 13:31:47 +0100	[thread overview]
Message-ID: <20221209123147.591982-1-benedikt.niedermayr@siemens.com> (raw)

From: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>

This bug has been introduced after switching from -1 to UINT_MAX
for GPMC_WAITPIN_INVALID.

The bug leads to an error when the optional gpmc,wait-pin
dt-property is not used:

...
gpmc_cs_program_settings: invalid wait-pin (-1)
...

Signed-off-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
Fixes: 8dd7e4af5853 ("memory: omap-gpmc: fix coverity issue "Control flow issues"")
Cc: Rob Herring <robh+dt@kernel.org>
---
 drivers/memory/omap-gpmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 57d9f91fe89b..d78f73db37c8 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -1918,7 +1918,8 @@ int gpmc_cs_program_settings(int cs, struct gpmc_settings *p)
 		}
 	}
 
-	if (p->wait_pin > gpmc_nr_waitpins) {
+	if (p->wait_pin != GPMC_WAITPIN_INVALID &&
+	    p->wait_pin > gpmc_nr_waitpins) {
 		pr_err("%s: invalid wait-pin (%d)\n", __func__, p->wait_pin);
 		return -EINVAL;
 	}
-- 
2.25.1


             reply	other threads:[~2022-12-09 12:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 12:31 B. Niedermayr [this message]
2022-12-12  7:16 ` [PATCH] memory: omap-gpmc: fix wait pin validation Tony Lindgren
2022-12-12  9:08 ` Roger Quadros

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=20221209123147.591982-1-benedikt.niedermayr@siemens.com \
    --to=benedikt.niedermayr@siemens.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=tony@atomide.com \
    /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).