[PATCH] hwmon: kzalloc conversion
Use kzalloc instead of kmalloc+memset in all hardware monitoring drivers. Signed-off-by: Deepak Saxena <dsaxena@plexity.net> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Šī revīzija ir iekļauta:

revīziju iesūtīja
Greg Kroah-Hartman

vecāks
2286066faf
revīzija
ba9c2e8d15
@@ -889,12 +889,11 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind,
|
||||
const char *client_name = "";
|
||||
struct w83781d_data *data = i2c_get_clientdata(new_client);
|
||||
|
||||
data->lm75[0] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
||||
data->lm75[0] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
||||
if (!(data->lm75[0])) {
|
||||
err = -ENOMEM;
|
||||
goto ERROR_SC_0;
|
||||
}
|
||||
memset(data->lm75[0], 0x00, sizeof (struct i2c_client));
|
||||
|
||||
id = i2c_adapter_id(adapter);
|
||||
|
||||
@@ -919,13 +918,11 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind,
|
||||
}
|
||||
|
||||
if (kind != w83783s) {
|
||||
|
||||
data->lm75[1] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
||||
data->lm75[1] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
||||
if (!(data->lm75[1])) {
|
||||
err = -ENOMEM;
|
||||
goto ERROR_SC_1;
|
||||
}
|
||||
memset(data->lm75[1], 0x0, sizeof(struct i2c_client));
|
||||
|
||||
if (force_subclients[0] == id &&
|
||||
force_subclients[1] == address) {
|
||||
@@ -1064,11 +1061,10 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
|
||||
client structure, even though we cannot fill it completely yet.
|
||||
But it allows us to access w83781d_{read,write}_value. */
|
||||
|
||||
if (!(data = kmalloc(sizeof(struct w83781d_data), GFP_KERNEL))) {
|
||||
if (!(data = kzalloc(sizeof(struct w83781d_data), GFP_KERNEL))) {
|
||||
err = -ENOMEM;
|
||||
goto ERROR1;
|
||||
}
|
||||
memset(data, 0, sizeof(struct w83781d_data));
|
||||
|
||||
new_client = &data->client;
|
||||
i2c_set_clientdata(new_client, data);
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user