lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1282048884.2626.2.camel@phoenix>
Date:	Tue, 17 Aug 2010 20:41:24 +0800
From:	Axel Lin <axel.lin@...il.com>
To:	linux-kernel <linux-kernel@...r.kernel.org>
Cc:	Jean Delvare <khali@...ux-fr.org>,
	Paul Thomas <pthomas8589@...il.com>, lm-sensors@...sensors.org
Subject: [PATCH v2] hwmon: (ads7871) Fix ads7871_probe error path

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@...il.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:
-- 
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ