You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2286066faf
commit
ba9c2e8d15
@@ -204,11 +204,10 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access adm1021_{read,write}_value. */
|
But it allows us to access adm1021_{read,write}_value. */
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct adm1021_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct adm1021_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto error0;
|
goto error0;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct adm1021_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -331,11 +331,10 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct adm1025_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct adm1025_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct adm1025_data));
|
|
||||||
|
|
||||||
/* The common I2C client data is placed right before the
|
/* The common I2C client data is placed right before the
|
||||||
ADM1025-specific data. */
|
ADM1025-specific data. */
|
||||||
|
|||||||
@@ -1470,13 +1470,11 @@ int adm1026_detect(struct i2c_adapter *adapter, int address,
|
|||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access adm1026_{read,write}_value. */
|
But it allows us to access adm1026_{read,write}_value. */
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct adm1026_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct adm1026_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(data, 0, sizeof(struct adm1026_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
new_client->addr = address;
|
new_client->addr = address;
|
||||||
|
|||||||
@@ -740,11 +740,10 @@ static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct adm1031_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct adm1031_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct adm1031_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -629,19 +629,17 @@ static int asb100_detect_subclients(struct i2c_adapter *adapter, int address,
|
|||||||
int i, id, err;
|
int i, id, err;
|
||||||
struct asb100_data *data = i2c_get_clientdata(new_client);
|
struct asb100_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])) {
|
if (!(data->lm75[0])) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto ERROR_SC_0;
|
goto ERROR_SC_0;
|
||||||
}
|
}
|
||||||
memset(data->lm75[0], 0x00, sizeof(struct i2c_client));
|
|
||||||
|
|
||||||
data->lm75[1] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
data->lm75[1] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
|
||||||
if (!(data->lm75[1])) {
|
if (!(data->lm75[1])) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto ERROR_SC_1;
|
goto ERROR_SC_1;
|
||||||
}
|
}
|
||||||
memset(data->lm75[1], 0x00, sizeof(struct i2c_client));
|
|
||||||
|
|
||||||
id = i2c_adapter_id(adapter);
|
id = i2c_adapter_id(adapter);
|
||||||
|
|
||||||
@@ -724,12 +722,11 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access asb100_{read,write}_value. */
|
But it allows us to access asb100_{read,write}_value. */
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct asb100_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct asb100_data), GFP_KERNEL))) {
|
||||||
pr_debug("asb100.o: detect failed, kmalloc failed!\n");
|
pr_debug("asb100.o: detect failed, kzalloc failed!\n");
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto ERROR0;
|
goto ERROR0;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct asb100_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
init_MUTEX(&data->lock);
|
init_MUTEX(&data->lock);
|
||||||
|
|||||||
@@ -268,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))
|
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct atxp1_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct atxp1_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(data, 0, sizeof(struct atxp1_data));
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
/* OK. For now, we presume we have a valid client. We now create the
|
||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access ds1621_{read,write}_value. */
|
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;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct ds1621_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -303,11 +303,10 @@ static int fscher_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
/* OK. For now, we presume we have a valid client. We now create the
|
/* OK. For now, we presume we have a valid client. We now create the
|
||||||
* client structure, even though we cannot fill it completely yet.
|
* client structure, even though we cannot fill it completely yet.
|
||||||
* But it allows us to access i2c_smbus_read_byte_data. */
|
* But it allows us to access i2c_smbus_read_byte_data. */
|
||||||
if (!(data = kmalloc(sizeof(struct fscher_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct fscher_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct fscher_data));
|
|
||||||
|
|
||||||
/* The common I2C client data is placed right before the
|
/* The common I2C client data is placed right before the
|
||||||
* Hermes-specific data. */
|
* Hermes-specific data. */
|
||||||
|
|||||||
@@ -453,11 +453,10 @@ int fscpos_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
* But it allows us to access fscpos_{read,write}_value.
|
* But it allows us to access fscpos_{read,write}_value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct fscpos_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct fscpos_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct fscpos_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -365,11 +365,10 @@ static int gl518_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access gl518_{read,write}_value. */
|
But it allows us to access gl518_{read,write}_value. */
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct gl518_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct gl518_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct gl518_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -536,11 +536,10 @@ static int gl520_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access gl520_{read,write}_value. */
|
But it allows us to access gl520_{read,write}_value. */
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct gl520_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct gl520_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct gl520_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -761,11 +761,10 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access it87_{read,write}_value. */
|
But it allows us to access it87_{read,write}_value. */
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct it87_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct it87_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto ERROR1;
|
goto ERROR1;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct it87_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
if (is_isa)
|
if (is_isa)
|
||||||
|
|||||||
@@ -375,11 +375,10 @@ static int lm63_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct lm63_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct lm63_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct lm63_data));
|
|
||||||
|
|
||||||
/* The common I2C client data is placed right before the
|
/* The common I2C client data is placed right before the
|
||||||
LM63-specific data. */
|
LM63-specific data. */
|
||||||
|
|||||||
@@ -127,11 +127,10 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
/* OK. For now, we presume we have a valid client. We now create the
|
/* OK. For now, we presume we have a valid client. We now create the
|
||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access lm75_{read,write}_value. */
|
But it allows us to access lm75_{read,write}_value. */
|
||||||
if (!(data = kmalloc(sizeof(struct lm75_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct lm75_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct lm75_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -226,11 +226,10 @@ static int lm77_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
/* OK. For now, we presume we have a valid client. We now create the
|
/* OK. For now, we presume we have a valid client. We now create the
|
||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access lm77_{read,write}_value. */
|
But it allows us to access lm77_{read,write}_value. */
|
||||||
if (!(data = kmalloc(sizeof(struct lm77_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct lm77_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct lm77_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -540,11 +540,10 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access lm78_{read,write}_value. */
|
But it allows us to access lm78_{read,write}_value. */
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct lm78_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct lm78_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto ERROR1;
|
goto ERROR1;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct lm78_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
if (is_isa)
|
if (is_isa)
|
||||||
|
|||||||
@@ -407,11 +407,10 @@ int lm80_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
/* OK. For now, we presume we have a valid client. We now create the
|
/* OK. For now, we presume we have a valid client. We now create the
|
||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access lm80_{read,write}_value. */
|
But it allows us to access lm80_{read,write}_value. */
|
||||||
if (!(data = kmalloc(sizeof(struct lm80_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct lm80_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct lm80_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -230,11 +230,10 @@ static int lm83_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct lm83_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct lm83_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct lm83_data));
|
|
||||||
|
|
||||||
/* The common I2C client data is placed right after the
|
/* The common I2C client data is placed right after the
|
||||||
* LM83-specific data. */
|
* LM83-specific data. */
|
||||||
|
|||||||
@@ -1033,11 +1033,10 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
|
|||||||
client structure, even though we cannot fill it completely yet.
|
client structure, even though we cannot fill it completely yet.
|
||||||
But it allows us to access lm85_{read,write}_value. */
|
But it allows us to access lm85_{read,write}_value. */
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct lm85_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct lm85_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto ERROR0;
|
goto ERROR0;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct lm85_data));
|
|
||||||
|
|
||||||
new_client = &data->client;
|
new_client = &data->client;
|
||||||
i2c_set_clientdata(new_client, data);
|
i2c_set_clientdata(new_client, data);
|
||||||
|
|||||||
@@ -554,11 +554,10 @@ static int lm87_detect(struct i2c_adapter *adapter, int address, int kind)
|
|||||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if (!(data = kmalloc(sizeof(struct lm87_data), GFP_KERNEL))) {
|
if (!(data = kzalloc(sizeof(struct lm87_data), GFP_KERNEL))) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct lm87_data));
|
|
||||||
|
|
||||||
/* The common I2C client data is placed right before the
|
/* The common I2C client data is placed right before the
|
||||||
LM87-specific data. */
|
LM87-specific data. */
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user