summaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorXie Shaowen <studentxswpy@163.com>2022-08-02 15:41:48 +0800
committerMichael Ellerman <mpe@ellerman.id.au>2022-11-24 23:12:18 +1100
commitdbaa3105736d4d73063ea0a3b01cd7fafce924e6 (patch)
tree0f902dad8a416665b3c614024dfdd7343d47b2cc /drivers/macintosh
parent5ca86eae55a2f006e6c1edd2029b2cacb6979515 (diff)
downloadlinux-dbaa3105736d4d73063ea0a3b01cd7fafce924e6.tar.gz
linux-dbaa3105736d4d73063ea0a3b01cd7fafce924e6.tar.bz2
linux-dbaa3105736d4d73063ea0a3b01cd7fafce924e6.zip
macintosh/macio-adb: check the return value of ioremap()
The function ioremap() in macio_init() can fail, so its return value should be checked. Fixes: 36874579dbf4c ("[PATCH] powerpc: macio-adb build fix") Reported-by: Hacash Robot <hacashRobot@santino.com> Signed-off-by: Xie Shaowen <studentxswpy@163.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220802074148.3213659-1-studentxswpy@163.com
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/macio-adb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
index 3721402582b4..55a9f8c3a150 100644
--- a/drivers/macintosh/macio-adb.c
+++ b/drivers/macintosh/macio-adb.c
@@ -108,6 +108,10 @@ int macio_init(void)
return -ENXIO;
}
adb = ioremap(r.start, sizeof(struct adb_regs));
+ if (!adb) {
+ of_node_put(adbs);
+ return -ENOMEM;
+ }
out_8(&adb->ctrl.r, 0);
out_8(&adb->intr.r, 0);