From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Fri, 20 Jun 2014 19:32:46 +0200 (CEST) Received: from mailapp01.imgtec.com ([195.59.15.196]:55261 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6859948AbaFTRcjbFq6h (ORCPT ); Fri, 20 Jun 2014 19:32:39 +0200 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 88AB1BAE316EB; Fri, 20 Jun 2014 18:32:29 +0100 (IST) Received: from KLMAIL02.kl.imgtec.org (192.168.5.97) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 20 Jun 2014 18:32:32 +0100 Received: from hhmail02.hh.imgtec.org (10.100.10.20) by klmail02.kl.imgtec.org (192.168.5.97) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 20 Jun 2014 18:32:32 +0100 Received: from BAMAIL02.ba.imgtec.org (192.168.66.28) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 20 Jun 2014 18:32:31 +0100 Received: from [10.20.2.221] (10.20.2.221) by bamail02.ba.imgtec.org (192.168.66.28) with Microsoft SMTP Server (TLS) id 14.3.174.1; Fri, 20 Jun 2014 10:32:30 -0700 Message-ID: <53A4702D.3090503@imgtec.com> Date: Fri, 20 Jun 2014 10:32:29 -0700 From: Deng-Cheng Zhu User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Sebastien Bourdelin , , Ralf Baechle , "Steven J. Hill" , John Crispin , "Qais Yousef" CC: , Jerome Oufella Subject: Re: [PATCH 1/1] MIPS: APRP: Fix an issue when device_create() fails. References: <1403209823-6376-1-git-send-email-sebastien.bourdelin@savoirfairelinux.com> In-Reply-To: <1403209823-6376-1-git-send-email-sebastien.bourdelin@savoirfairelinux.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.20.2.221] Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 40648 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: dengcheng.zhu@imgtec.com Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips On 06/19/2014 01:30 PM, Sebastien Bourdelin wrote: > 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 > --- > arch/mips/kernel/rtlx-cmp.c | 3 +++ > arch/mips/kernel/rtlx-mt.c | 3 +++ > 2 files changed, 6 insertions(+) > > diff --git a/arch/mips/kernel/rtlx-cmp.c b/arch/mips/kernel/rtlx-cmp.c > index 758fb3c..d26dcc4 100644 > --- a/arch/mips/kernel/rtlx-cmp.c > +++ b/arch/mips/kernel/rtlx-cmp.c > @@ -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--) --i? > + device_destroy(mt_class, MKDEV(major, i)); > + > err = PTR_ERR(dev); > goto out_chrdev; > } > diff --git a/arch/mips/kernel/rtlx-mt.c b/arch/mips/kernel/rtlx-mt.c > index 5a66b97..cb95470 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--) Same here. > + device_destroy(mt_class, MKDEV(major, i)); > + > err = PTR_ERR(dev); > goto out_chrdev; > } Deng-Cheng From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailapp01.imgtec.com ([195.59.15.196]:55261 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6859948AbaFTRcjbFq6h (ORCPT ); Fri, 20 Jun 2014 19:32:39 +0200 Message-ID: <53A4702D.3090503@imgtec.com> Date: Fri, 20 Jun 2014 10:32:29 -0700 From: Deng-Cheng Zhu MIME-Version: 1.0 Subject: Re: [PATCH 1/1] MIPS: APRP: Fix an issue when device_create() fails. References: <1403209823-6376-1-git-send-email-sebastien.bourdelin@savoirfairelinux.com> In-Reply-To: <1403209823-6376-1-git-send-email-sebastien.bourdelin@savoirfairelinux.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-Path: Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-subscribe: List-owner: List-post: List-archive: To: Sebastien Bourdelin , linux-mips@linux-mips.org, Ralf Baechle , "Steven J. Hill" , John Crispin , Qais Yousef Cc: linux-kernel@vger.kernel.org, Jerome Oufella Message-ID: <20140620173229.k3JZwNCEwmUAaKhfumHEFjnYPTPIzaZSvL8yNtecg6g@z> On 06/19/2014 01:30 PM, Sebastien Bourdelin wrote: > 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 > --- > arch/mips/kernel/rtlx-cmp.c | 3 +++ > arch/mips/kernel/rtlx-mt.c | 3 +++ > 2 files changed, 6 insertions(+) > > diff --git a/arch/mips/kernel/rtlx-cmp.c b/arch/mips/kernel/rtlx-cmp.c > index 758fb3c..d26dcc4 100644 > --- a/arch/mips/kernel/rtlx-cmp.c > +++ b/arch/mips/kernel/rtlx-cmp.c > @@ -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--) --i? > + device_destroy(mt_class, MKDEV(major, i)); > + > err = PTR_ERR(dev); > goto out_chrdev; > } > diff --git a/arch/mips/kernel/rtlx-mt.c b/arch/mips/kernel/rtlx-mt.c > index 5a66b97..cb95470 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--) Same here. > + device_destroy(mt_class, MKDEV(major, i)); > + > err = PTR_ERR(dev); > goto out_chrdev; > } Deng-Cheng