summaryrefslogtreecommitdiff
path: root/drivers/mtd/mtdcore.h
diff options
context:
space:
mode:
authorBoris Brezillon <bbrezillon@kernel.org>2019-01-02 17:36:54 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-05 17:35:06 +0300
commitd63d0816c2f412394c10a0bd17bb83c7b1c2a3de (patch)
tree3d41eec762bb0df285aac618d038a0f2a87e074c /drivers/mtd/mtdcore.h
parent4964ffcbac63267a065fb81af62fbeea5da10ee4 (diff)
downloadlinux-d63d0816c2f412394c10a0bd17bb83c7b1c2a3de.tar.xz
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>
Diffstat (limited to 'drivers/mtd/mtdcore.h')
-rw-r--r--drivers/mtd/mtdcore.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/mtdcore.h b/drivers/mtd/mtdcore.h
index 55fdb8e1fd2a..488b652ba9e6 100644
--- a/drivers/mtd/mtdcore.h
+++ b/drivers/mtd/mtdcore.h
@@ -6,7 +6,7 @@
extern struct mutex mtd_table_mutex;
struct mtd_info *__mtd_next_device(int i);
-int add_mtd_device(struct mtd_info *mtd);
+int __must_check add_mtd_device(struct mtd_info *mtd);
int del_mtd_device(struct mtd_info *mtd);
int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
int del_mtd_partitions(struct mtd_info *);