Skip to content

Commit

Permalink
MIPS: APRP: Fix an issue when device_create() fails.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sebastien Bourdelin authored and Ralf Baechle committed Aug 1, 2014
1 parent ffc8415 commit 0435b13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/mips/kernel/rtlx-cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,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;
}
Expand Down
3 changes: 3 additions & 0 deletions arch/mips/kernel/rtlx-mt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0435b13

Please sign in to comment.