All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
To: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>,
	<linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>,
	"Steven J. Hill" <Steven.Hill@imgtec.com>,
	John Crispin <blogic@openwrt.org>,
	"Qais Yousef" <Qais.Yousef@imgtec.com>
Cc: <linux-kernel@vger.kernel.org>,
	Jerome Oufella <jerome.oufella@savoirfairelinux.com>
Subject: Re: [PATCH 1/1] MIPS: APRP: Fix an issue when device_create() fails.
Date: Fri, 20 Jun 2014 10:32:29 -0700	[thread overview]
Message-ID: <53A4702D.3090503@imgtec.com> (raw)
In-Reply-To: <1403209823-6376-1-git-send-email-sebastien.bourdelin@savoirfairelinux.com>

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 <sebastien.bourdelin@savoirfairelinux.com>
> ---
>   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

WARNING: multiple messages have this Message-ID (diff)
From: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
To: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>,
	linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
	"Steven J. Hill" <Steven.Hill@imgtec.com>,
	John Crispin <blogic@openwrt.org>,
	Qais Yousef <Qais.Yousef@imgtec.com>
Cc: linux-kernel@vger.kernel.org,
	Jerome Oufella <jerome.oufella@savoirfairelinux.com>
Subject: Re: [PATCH 1/1] MIPS: APRP: Fix an issue when device_create() fails.
Date: Fri, 20 Jun 2014 10:32:29 -0700	[thread overview]
Message-ID: <53A4702D.3090503@imgtec.com> (raw)
Message-ID: <20140620173229.k3JZwNCEwmUAaKhfumHEFjnYPTPIzaZSvL8yNtecg6g@z> (raw)
In-Reply-To: <1403209823-6376-1-git-send-email-sebastien.bourdelin@savoirfairelinux.com>

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 <sebastien.bourdelin@savoirfairelinux.com>
> ---
>   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

  reply	other threads:[~2014-06-20 17:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 20:30 [PATCH 1/1] MIPS: APRP: Fix an issue when device_create() fails Sebastien Bourdelin
2014-06-20 17:32 ` Deng-Cheng Zhu [this message]
2014-06-20 17:32   ` Deng-Cheng Zhu
2014-06-20 19:15   ` Sebastien Bourdelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53A4702D.3090503@imgtec.com \
    --to=dengcheng.zhu@imgtec.com \
    --cc=Qais.Yousef@imgtec.com \
    --cc=Steven.Hill@imgtec.com \
    --cc=blogic@openwrt.org \
    --cc=jerome.oufella@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=sebastien.bourdelin@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.