summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/rtlx-mt.c
diff options
context:
space:
mode:
authorSebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>2014-06-19 16:30:23 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-08-01 17:30:35 +0200
commit0435b13ee3732c1dda5312025f49073d01d8d15d (patch)
treee57906251b575a88be22d1a881eb3d37522cb8c0 /arch/mips/kernel/rtlx-mt.c
parentffc8415afab20bd97754efae6aad1f67b531132b (diff)
downloadtalos-op-linux-0435b13ee3732c1dda5312025f49073d01d8d15d.tar.gz
talos-op-linux-0435b13ee3732c1dda5312025f49073d01d8d15d.zip
MIPS: APRP: Fix an issue when device_create() fails.
If a call to device_create() fails for a channel during the initialize loop, we need to clean the devices entries already created before leaving. Signed-off-by: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com> Cc: linux-mips@linux-mips.org Cc: Steven J. Hill <Steven.Hill@imgtec.com> Cc: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com> Cc: John Crispin <blogic@openwrt.org> Cc: Qais Yousef <Qais.Yousef@imgtec.com> Cc: linux-kernel@vger.kernel.org Cc: Jerome Oufella <jerome.oufella@savoirfairelinux.com> Patchwork: https://patchwork.linux-mips.org/patch/7111/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/rtlx-mt.c')
-rw-r--r--arch/mips/kernel/rtlx-mt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/mips/kernel/rtlx-mt.c b/arch/mips/kernel/rtlx-mt.c
index 5a66b975989e..cb95470e2e69 100644
--- a/arch/mips/kernel/rtlx-mt.c
+++ b/arch/mips/kernel/rtlx-mt.c
@@ -103,6 +103,9 @@ int __init rtlx_module_init(void)
dev = device_create(mt_class, NULL, MKDEV(major, i), NULL,
"%s%d", RTLX_MODULE_NAME, i);
if (IS_ERR(dev)) {
+ while (i--)
+ device_destroy(mt_class, MKDEV(major, i));
+
err = PTR_ERR(dev);
goto out_chrdev;
}
OpenPOWER on IntegriCloud