diff options
Diffstat (limited to 'drivers/hwmon/ds1621.c')
| -rw-r--r-- | drivers/hwmon/ds1621.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index b0199e063d0e..34f71b7c7f37 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
| @@ -180,12 +180,14 @@ static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, set_temp_max); | |||
| 180 | 180 | ||
| 181 | static int ds1621_attach_adapter(struct i2c_adapter *adapter) | 181 | static int ds1621_attach_adapter(struct i2c_adapter *adapter) |
| 182 | { | 182 | { |
| 183 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
| 184 | return 0; | ||
| 183 | return i2c_probe(adapter, &addr_data, ds1621_detect); | 185 | return i2c_probe(adapter, &addr_data, ds1621_detect); |
| 184 | } | 186 | } |
| 185 | 187 | ||
| 186 | /* This function is called by i2c_probe */ | 188 | /* This function is called by i2c_probe */ |
| 187 | int ds1621_detect(struct i2c_adapter *adapter, int address, | 189 | static int ds1621_detect(struct i2c_adapter *adapter, int address, |
| 188 | int kind) | 190 | int kind) |
| 189 | { | 191 | { |
| 190 | int conf, temp; | 192 | int conf, temp; |
| 191 | struct i2c_client *new_client; | 193 | struct i2c_client *new_client; |
| @@ -200,11 +202,10 @@ int ds1621_detect(struct i2c_adapter *adapter, int address, | |||
| 200 | /* OK. For now, we presume we have a valid client. We now create the | 202 | /* OK. For now, we presume we have a valid client. We now create the |
| 201 | client structure, even though we cannot fill it completely yet. | 203 | client structure, even though we cannot fill it completely yet. |
| 202 | But it allows us to access ds1621_{read,write}_value. */ | 204 | But it allows us to access ds1621_{read,write}_value. */ |
| 203 | if (!(data = kmalloc(sizeof(struct ds1621_data), GFP_KERNEL))) { | 205 | if (!(data = kzalloc(sizeof(struct ds1621_data), GFP_KERNEL))) { |
| 204 | err = -ENOMEM; | 206 | err = -ENOMEM; |
| 205 | goto exit; | 207 | goto exit; |
| 206 | } | 208 | } |
| 207 | memset(data, 0, sizeof(struct ds1621_data)); | ||
| 208 | 209 | ||
| 209 | new_client = &data->client; | 210 | new_client = &data->client; |
| 210 | i2c_set_clientdata(new_client, data); | 211 | i2c_set_clientdata(new_client, data); |
