X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fhwmon%2Fatxp1.c;h=53324f56404e2c38979e8b7401e6b4b254028783;hb=a9931a6e37c09f6b76a9fa0cbd777c335548692b;hp=deb4d34c9539bab6428d9f5fad5d62a357b787b2;hpb=c08319a9d50b5c9cb4fdb33728bd16497cf4ddd3;p=linux-2.6 diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index deb4d34c95..53324f5640 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c @@ -253,6 +253,8 @@ static DEVICE_ATTR(gpio2, S_IRUGO | S_IWUSR, atxp1_showgpio2, atxp1_storegpio2); static int atxp1_attach_adapter(struct i2c_adapter *adapter) { + if (!(adapter->class & I2C_CLASS_HWMON)) + return 0; return i2c_probe(adapter, &addr_data, &atxp1_detect); }; @@ -266,12 +268,11 @@ static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind) if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) goto exit; - if (!(data = kmalloc(sizeof(struct atxp1_data), GFP_KERNEL))) { + if (!(data = kzalloc(sizeof(struct atxp1_data), GFP_KERNEL))) { err = -ENOMEM; goto exit; } - memset(data, 0, sizeof(struct atxp1_data)); new_client = &data->client; i2c_set_clientdata(new_client, data);