Skip to content

Commit ffd4333

Browse files
Lu Weigregkh
authored andcommitted
maple: fix wrong return value of maple_bus_init().
[ Upstream commit bde82ee391fa6d3ad054313c4aa7b726d32515ce ] If KMEM_CACHE or maple_alloc_dev failed, the maple_bus_init() will return 0 rather than error, because the retval is not changed after KMEM_CACHE or maple_alloc_dev failed. Fixes: 17be2d2 ("sh: Add maple bus support for the SEGA Dreamcast.") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Lu Wei <[email protected]> Acked-by: John Paul Adrian Glaubitz <[email protected]> Signed-off-by: Rich Felker <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 88d87e0 commit ffd4333

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/sh/maple/maple.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,10 @@ static int __init maple_bus_init(void)
835835

836836
maple_queue_cache = KMEM_CACHE(maple_buffer, SLAB_HWCACHE_ALIGN);
837837

838-
if (!maple_queue_cache)
838+
if (!maple_queue_cache) {
839+
retval = -ENOMEM;
839840
goto cleanup_bothirqs;
841+
}
840842

841843
INIT_LIST_HEAD(&maple_waitq);
842844
INIT_LIST_HEAD(&maple_sentq);
@@ -849,6 +851,7 @@ static int __init maple_bus_init(void)
849851
if (!mdev[i]) {
850852
while (i-- > 0)
851853
maple_free_dev(mdev[i]);
854+
retval = -ENOMEM;
852855
goto cleanup_cache;
853856
}
854857
baseunits[i] = mdev[i];

0 commit comments

Comments
 (0)