OSDN Git Service

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 08:21:05 +0000 (09:21 +0100)
commit5c4c8e4f800b4871b4794df84fecb0d4e73987de
treef8ac8b32b11e04a410d0062a72b325a60d11792c
parent6a471a2665a988641b177553e1493831dd2acea2
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