The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ren Yu <renyu@nfschina.com>
To: tony@atomide.com
Cc: aaro.koskinen@iki.fi, linux@armlinux.org.uk,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, liqiong@nfschina.com,
	yuzhe@nfschina.com, Ren Yu <renyu@nfschina.com>
Subject: [PATCH] plat-omap: check return value of ioremap()
Date: Mon, 25 Apr 2022 19:08:45 +0800	[thread overview]
Message-ID: <20220425110845.415439-1-renyu@nfschina.com> (raw)

When ioremap() failed,return err

Signed-off-by: Ren Yu <renyu@nfschina.com>
---
 arch/arm/plat-omap/debug-leds.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 2b698d074874..bf5034e10f6e 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -109,6 +109,9 @@ static int fpga_probe(struct platform_device *pdev)
 		return -ENODEV;
 
 	fpga = ioremap(iomem->start, resource_size(iomem));
+	if (!fpga)
+		return -ENOMEM;
+
 	writew_relaxed(0xff, &fpga->leds);
 
 	for (i = 0; i < ARRAY_SIZE(dbg_leds); i++) {
-- 
2.25.1


             reply	other threads:[~2022-04-25 11:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25 11:08 Ren Yu [this message]
2022-04-26  8:05 ` [PATCH] plat-omap: check return value of ioremap() Tony Lindgren

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=20220425110845.415439-1-renyu@nfschina.com \
    --to=renyu@nfschina.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=liqiong@nfschina.com \
    --cc=tony@atomide.com \
    --cc=yuzhe@nfschina.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