[PATCH v2] hwmon: The code crashes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The code crashes, since dev is not an i2c client device.
---
Mistakes were made in the process of merging.

Signed-off-by: Il Han <corone.il.han@xxxxxxxxx>
---
 drivers/hwmon/max31790.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/max31790.c b/drivers/hwmon/max31790.c
index d9b0003..f129668 100644
--- a/drivers/hwmon/max31790.c
+++ b/drivers/hwmon/max31790.c
@@ -206,8 +206,8 @@ static ssize_t set_fan_target(struct device *dev,
 			      const char *buf, size_t count)
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-	struct i2c_client *client = to_i2c_client(dev);
-	struct max31790_data *data = i2c_get_clientdata(client);
+	struct max31790_data *data = dev_get_drvdata(dev);
+	struct i2c_client *client = data->client;
 	u8 bits;
 	int sr;
 	int target_count;
@@ -273,8 +273,8 @@ static ssize_t set_pwm(struct device *dev,
 		       const char *buf, size_t count)
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-	struct i2c_client *client = to_i2c_client(dev);
-	struct max31790_data *data = i2c_get_clientdata(client);
+	struct max31790_data *data = dev_get_drvdata(dev);
+	struct i2c_client *client = data->client;
 	unsigned long pwm;
 	int err;
 
@@ -325,8 +325,8 @@ static ssize_t set_pwm_enable(struct device *dev,
 			      const char *buf, size_t count)
 {
 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-	struct i2c_client *client = to_i2c_client(dev);
-	struct max31790_data *data = i2c_get_clientdata(client);
+	struct max31790_data *data = dev_get_drvdata(dev);
+	struct i2c_client *client = data->client;
 	unsigned long mode;
 	int err;
 
-- 
2.4.1


_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux