public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Axel Lin <axel.lin@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Paul Thomas <pthomas8589@gmail.com>,
	lm-sensors@lm-sensors.org
Subject: Re: [PATCH v2] hwmon: (ads7871) Fix ads7871_probe error path
Date: Tue, 17 Aug 2010 16:10:48 +0200	[thread overview]
Message-ID: <20100817161048.51b42394@hyperion.delvare> (raw)
In-Reply-To: <1282048884.2626.2.camel@phoenix>

On Tue, 17 Aug 2010 20:41:24 +0800, Axel Lin wrote:
> This patch moves hwmon_device_register() to the end of ads7871_probe().
> So we can make sure the device exists and is properly initialized
> before the device is exposed to user-space.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/hwmon/ads7871.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
> index b300a20..45f5829 100644
> --- a/drivers/hwmon/ads7871.c
> +++ b/drivers/hwmon/ads7871.c
> @@ -176,12 +176,6 @@ static int __devinit ads7871_probe(struct spi_device *spi)
>  	if (status < 0)
>  		goto error_free;
>  
> -	pdata->hwmon_dev = hwmon_device_register(&spi->dev);
> -	if (IS_ERR(pdata->hwmon_dev)) {
> -		err = PTR_ERR(pdata->hwmon_dev);
> -		goto error_remove;
> -	}
> -
>  	spi_set_drvdata(spi, pdata);
>  
>  	/* Configure the SPI bus */
> @@ -204,6 +198,12 @@ static int __devinit ads7871_probe(struct spi_device *spi)
>  		goto error_remove;
>  	}
>  
> +	pdata->hwmon_dev = hwmon_device_register(&spi->dev);
> +	if (IS_ERR(pdata->hwmon_dev)) {
> +		err = PTR_ERR(pdata->hwmon_dev);
> +		goto error_remove;
> +	}
> +
>  	return 0;
>  
>  error_remove:

Applied, thanks.

-- 
Jean Delvare

  reply	other threads:[~2010-08-17 14:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-17 12:41 [PATCH v2] hwmon: (ads7871) Fix ads7871_probe error path Axel Lin
2010-08-17 14:10 ` Jean Delvare [this message]
2010-08-22 11:58   ` Jean Delvare

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=20100817161048.51b42394@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=axel.lin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=pthomas8589@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox