diff options
author | Boris Brezillon <bbrezillon@kernel.org> | 2019-01-02 15:36:54 +0100 |
---|---|---|
committer | Boris Brezillon <bbrezillon@kernel.org> | 2019-01-07 14:06:24 +0100 |
commit | 2b6f0090a3335b7bdd03ca520c35591159463041 (patch) | |
tree | 57f2eccaf21d13cafbb2b499639ed5546d342283 /drivers/mtd/mtdcore.h | |
parent | 19e16fb4f319b84b3220e98abf726218beba8c34 (diff) | |
download | linux-2b6f0090a3335b7bdd03ca520c35591159463041.tar.gz |
mtd: Check add_mtd_device() ret code
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>
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 *); |