From ddec748f328af6b67e4d0ce0248a8e9f36751827 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Mon, 17 Oct 2005 23:02:42 +0200 Subject: [PATCH] hwmon: Missing class check in two hwmon drivers The atxp1 and ds1621 drivers should make sure they do not probe non-hwmon i2c adapters. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/ds1621.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/hwmon/ds1621.c') diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index b0199e063d0..e1ff22cf984 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -180,6 +180,8 @@ static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, set_temp_max); static int ds1621_attach_adapter(struct i2c_adapter *adapter) { + if (!(adapter->class & I2C_CLASS_HWMON)) + return 0; return i2c_probe(adapter, &addr_data, ds1621_detect); } -- cgit From ba9c2e8d15da029ea3051c95e446b2d638ef02e2 Mon Sep 17 00:00:00 2001 From: Deepak Saxena Date: Mon, 17 Oct 2005 23:08:32 +0200 Subject: [PATCH] hwmon: kzalloc conversion Use kzalloc instead of kmalloc+memset in all hardware monitoring drivers. Signed-off-by: Deepak Saxena Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/ds1621.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/hwmon/ds1621.c') diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index e1ff22cf984..c5afa005830 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -202,11 +202,10 @@ int ds1621_detect(struct i2c_adapter *adapter, int address, /* OK. For now, we presume we have a valid client. We now create the client structure, even though we cannot fill it completely yet. But it allows us to access ds1621_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct ds1621_data), GFP_KERNEL))) { + if (!(data = kzalloc(sizeof(struct ds1621_data), GFP_KERNEL))) { err = -ENOMEM; goto exit; } - memset(data, 0, sizeof(struct ds1621_data)); new_client = &data->client; i2c_set_clientdata(new_client, data); -- cgit From c49efceffa599299ab3f38b1cdf8c2f1bf9811c4 Mon Sep 17 00:00:00 2001 From: Ben Dooks Date: Wed, 26 Oct 2005 21:07:25 +0200 Subject: [PATCH] hwmon: Static function fixes, 3 of 4 Fixup functions that have been declared static and then actually defined without the static on. Signed-off-by: Ben Dooks Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/ds1621.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/hwmon/ds1621.c') diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index c5afa005830..34f71b7c7f3 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -186,8 +186,8 @@ static int ds1621_attach_adapter(struct i2c_adapter *adapter) } /* This function is called by i2c_probe */ -int ds1621_detect(struct i2c_adapter *adapter, int address, - int kind) +static int ds1621_detect(struct i2c_adapter *adapter, int address, + int kind) { int conf, temp; struct i2c_client *new_client; -- cgit