mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: studentxswpy@163.com
To: James.Bottomley@HansenPartnership.com, deller@gmx.de,
	dmitry.torokhov@gmail.com, linux-parisc@vger.kernel.org,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Xie Shaowen <studentxswpy@163.com>,
	Hacash Robot <hacashRobot@santino.com>
Subject: [PATCH] Input: check the return value of ioremap() in gscps2_probe()
Date: Tue,  2 Aug 2022 15:20:33 +0800	[thread overview]
Message-ID: <20220802072033.3211980-1-studentxswpy@163.com> (raw)

From: Xie Shaowen <studentxswpy@163.com>

The function ioremap() in gscps2_probe() can fail, so
its return value should be checked.

Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache")
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: Xie Shaowen <studentxswpy@163.com>
---
 drivers/input/serio/gscps2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c
index a9065c6ab550..da2c67cb8642 100644
--- a/drivers/input/serio/gscps2.c
+++ b/drivers/input/serio/gscps2.c
@@ -350,6 +350,10 @@ static int __init gscps2_probe(struct parisc_device *dev)
 	ps2port->port = serio;
 	ps2port->padev = dev;
 	ps2port->addr = ioremap(hpa, GSC_STATUS + 4);
+	if (!ps2port->addr) {
+		ret = -ENOMEM;
+		goto fail_nomem;
+	}
 	spin_lock_init(&ps2port->lock);
 
 	gscps2_reset(ps2port);
-- 
2.25.1


             reply	other threads:[~2022-08-02  7:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-02  7:20 studentxswpy [this message]
2022-08-02  8:35 ` Helge Deller

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=20220802072033.3211980-1-studentxswpy@163.com \
    --to=studentxswpy@163.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=deller@gmx.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hacashRobot@santino.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.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

all inboxes | Powered by JetHome®