Skip to content

Commit

Permalink
macintosh/macio-adb: check the return value of ioremap()
Browse files Browse the repository at this point in the history
[ Upstream commit dbaa310 ]

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

Fixes: 3687457 ("[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>
  • Loading branch information
liunxXsw authored and gregkh committed Dec 31, 2022
1 parent 19ded60 commit be2b9b1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/macintosh/macio-adb.c
Expand Up @@ -105,6 +105,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);
Expand Down

0 comments on commit be2b9b1

Please sign in to comment.