public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Paul Thomas <pthomas8589@gmail.com>,
	Jean Delvare <khali@linux-fr.org>,
	lm-sensors@lm-sensors.org
Subject: [PATCH] hwmon: (ads7871) Fix ads7871_probe error path
Date: Mon, 16 Aug 2010 09:31:17 +0800	[thread overview]
Message-ID: <1281922277.26991.3.camel@mola> (raw)

We need to call hwmon_device_unregister() if an error is detected after
sucessfully register hwmon device.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/hwmon/ads7871.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
index b300a20..303db92 100644
--- a/drivers/hwmon/ads7871.c
+++ b/drivers/hwmon/ads7871.c
@@ -201,11 +201,13 @@ static int __devinit ads7871_probe(struct spi_device *spi)
 	we need to make sure we really have a chip*/
 	if (val != ret) {
 		err = -ENODEV;
-		goto error_remove;
+		goto error_unregister;
 	}
 
 	return 0;
 
+error_unregister:
+	hwmon_device_unregister(pdata->hwmon_dev);
 error_remove:
 	sysfs_remove_group(&spi->dev.kobj, &ads7871_group);
 error_free:
-- 
1.7.2




             reply	other threads:[~2010-08-16  1:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16  1:31 Axel Lin [this message]
2010-08-17 11:07 ` [PATCH] hwmon: (ads7871) Fix ads7871_probe error path Jean Delvare
2010-08-17 15:15   ` Paul Thomas
2010-08-17 18:42     ` 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=1281922277.26991.3.camel@mola \
    --to=axel.lin@gmail.com \
    --cc=khali@linux-fr.org \
    --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