mtd: Check add_mtd_device() ret code
authorBoris Brezillon <bbrezillon@kernel.org>
Wed, 2 Jan 2019 14:36:54 +0000 (15:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 14:35:06 +0000 (15:35 +0100)
commitd63d0816c2f412394c10a0bd17bb83c7b1c2a3de
tree3d41eec762bb0df285aac618d038a0f2a87e074c
parent4964ffcbac63267a065fb81af62fbeea5da10ee4
mtd: Check add_mtd_device() ret code

[ Upstream commit 2b6f0090a3335b7bdd03ca520c35591159463041 ]

add_mtd_device() can fail. We should always check its return value
and gracefully handle the failure case. Fix the call sites where this
not done (in mtdpart.c) and add a __must_check attribute to the
prototype to avoid this kind of mistakes.

Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/mtdcore.h
drivers/mtd/mtdpart.c