diff options
author | Boris Brezillon <bbrezillon@kernel.org> | 2019-01-02 17:36:54 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-12-05 11:21:05 +0300 |
commit | 5c4c8e4f800b4871b4794df84fecb0d4e73987de (patch) | |
tree | f8ac8b32b11e04a410d0062a72b325a60d11792c /drivers/mtd/mtdcore.h | |
parent | 6a471a2665a988641b177553e1493831dd2acea2 (diff) | |
download | linux-5c4c8e4f800b4871b4794df84fecb0d4e73987de.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.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/mtdcore.h b/drivers/mtd/mtdcore.h index 9887bda317cd..b31c868019ad 100644 --- a/drivers/mtd/mtdcore.h +++ b/drivers/mtd/mtdcore.h @@ -7,7 +7,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 *); |