Commit 52534f2d authored by Wanlong Gao's avatar Wanlong Gao Committed by David Woodhouse

mtd: simplify get_mtd_device_nm function

'get_mtd_device_nm()' has a piece of code which equivalent to what
'__get_mtd_device()' does - remove this duplicated code and use
''__get_mtd_device()' instead.

Artem: changed commit message.
Artem: while on it, remove an unnecessary extra empty line
Signed-off-by: default avatarWanlong Gao <>
Signed-off-by: default avatarArtem Bityutskiy <>
Signed-off-by: default avatarDavid Woodhouse <>
parent 7c802fbd
......@@ -533,7 +533,6 @@ int __get_mtd_device(struct mtd_info *mtd)
return -ENODEV;
if (mtd->get_device) {
err = mtd->get_device(mtd);
if (err) {
......@@ -571,21 +570,13 @@ struct mtd_info *get_mtd_device_nm(const char *name)
if (!mtd)
goto out_unlock;
if (!try_module_get(mtd->owner))
err = __get_mtd_device(mtd);
if (err)
goto out_unlock;
if (mtd->get_device) {
err = mtd->get_device(mtd);
if (err)
goto out_put;
return mtd;
return ERR_PTR(err);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment