* [PATCH] Input: check the return value of ioremap() in gscps2_probe()
@ 2022-08-02 7:20 studentxswpy
2022-08-02 8:35 ` Helge Deller
0 siblings, 1 reply; 2+ messages in thread
From: studentxswpy @ 2022-08-02 7:20 UTC (permalink / raw)
To: James.Bottomley, deller, dmitry.torokhov, linux-parisc,
linux-input, linux-kernel
Cc: Xie Shaowen, Hacash Robot
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: check the return value of ioremap() in gscps2_probe()
2022-08-02 7:20 [PATCH] Input: check the return value of ioremap() in gscps2_probe() studentxswpy
@ 2022-08-02 8:35 ` Helge Deller
0 siblings, 0 replies; 2+ messages in thread
From: Helge Deller @ 2022-08-02 8:35 UTC (permalink / raw)
To: studentxswpy, James.Bottomley, dmitry.torokhov, linux-parisc,
linux-input, linux-kernel
Cc: Hacash Robot
On 8/2/22 09:20, studentxswpy@163.com wrote:
> 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>
I've applied it to the parisc git tree.
Thanks!
Helge
> ---
> 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-02 8:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 7:20 [PATCH] Input: check the return value of ioremap() in gscps2_probe() studentxswpy
2022-08-02 8:35 ` Helge Deller
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®