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:37:54 +0000 (15:37 +0100)
commit43ac6874069c9e6a01b3bce018778a230c153e75
tree75ac749510e68b251676fdb4c3874eb8806a106d
parentd8e74cb55c41aa7fae79afa399899728803417e9
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