diff options
author | Xie Shaowen <studentxswpy@163.com> | 2022-08-02 10:41:48 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-31 15:32:50 +0300 |
commit | 65572a13163f380cc33c19fda4dab86b2a14a093 (patch) | |
tree | 376c9755dcfca3cbaef5c7773cd6d9c2bca58cd2 /drivers/macintosh | |
parent | 76837e7f6b30da72ad59f56291e22804a219e015 (diff) | |
download | linux-65572a13163f380cc33c19fda4dab86b2a14a093.tar.xz |
macintosh/macio-adb: check the return value of ioremap()
[ Upstream commit dbaa3105736d4d73063ea0a3b01cd7fafce924e6 ]
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
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r-- | drivers/macintosh/macio-adb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c index 9b63bd2551c6..cd4e34d15c26 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); |