diff options
author | Deepak Saxena <dsaxena@plexity.net> | 2005-10-17 17:08:32 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 17:02:12 -0400 |
commit | ba9c2e8d15da029ea3051c95e446b2d638ef02e2 (patch) | |
tree | 28272b92080f18f16008c09464190939183c8698 /drivers/hwmon | |
parent | 2286066faf51890e49ad61e2ceab683666cd9108 (diff) |
[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>
Diffstat (limited to 'drivers/hwmon')
33 files changed, 39 insertions, 80 deletions
diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 58aee3a00caa..8102876c7c3f 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c | |||
@@ -204,11 +204,10 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind) | |||
204 | client structure, even though we cannot fill it completely yet. | 204 | client structure, even though we cannot fill it completely yet. |
205 | But it allows us to access adm1021_{read,write}_value. */ | 205 | But it allows us to access adm1021_{read,write}_value. */ |
206 | 206 | ||
207 | if (!(data = kmalloc(sizeof(struct adm1021_data), GFP_KERNEL))) { | 207 | if (!(data = kzalloc(sizeof(struct adm1021_data), GFP_KERNEL))) { |
208 | err = -ENOMEM; | 208 | err = -ENOMEM; |
209 | goto error0; | 209 | goto error0; |
210 | } | 210 | } |
211 | memset(data, 0, sizeof(struct adm1021_data)); | ||
212 | 211 | ||
213 | new_client = &data->client; | 212 | new_client = &data->client; |
214 | i2c_set_clientdata(new_client, data); | 213 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index 526b7ff179eb..3ec12421694f 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c | |||
@@ -331,11 +331,10 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind) | |||
331 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 331 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
332 | goto exit; | 332 | goto exit; |
333 | 333 | ||
334 | if (!(data = kmalloc(sizeof(struct adm1025_data), GFP_KERNEL))) { | 334 | if (!(data = kzalloc(sizeof(struct adm1025_data), GFP_KERNEL))) { |
335 | err = -ENOMEM; | 335 | err = -ENOMEM; |
336 | goto exit; | 336 | goto exit; |
337 | } | 337 | } |
338 | memset(data, 0, sizeof(struct adm1025_data)); | ||
339 | 338 | ||
340 | /* The common I2C client data is placed right before the | 339 | /* The common I2C client data is placed right before the |
341 | ADM1025-specific data. */ | 340 | ADM1025-specific data. */ |
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 625158110fd4..3b5814183738 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c | |||
@@ -1470,13 +1470,11 @@ int adm1026_detect(struct i2c_adapter *adapter, int address, | |||
1470 | client structure, even though we cannot fill it completely yet. | 1470 | client structure, even though we cannot fill it completely yet. |
1471 | But it allows us to access adm1026_{read,write}_value. */ | 1471 | But it allows us to access adm1026_{read,write}_value. */ |
1472 | 1472 | ||
1473 | if (!(data = kmalloc(sizeof(struct adm1026_data), GFP_KERNEL))) { | 1473 | if (!(data = kzalloc(sizeof(struct adm1026_data), GFP_KERNEL))) { |
1474 | err = -ENOMEM; | 1474 | err = -ENOMEM; |
1475 | goto exit; | 1475 | goto exit; |
1476 | } | 1476 | } |
1477 | 1477 | ||
1478 | memset(data, 0, sizeof(struct adm1026_data)); | ||
1479 | |||
1480 | new_client = &data->client; | 1478 | new_client = &data->client; |
1481 | i2c_set_clientdata(new_client, data); | 1479 | i2c_set_clientdata(new_client, data); |
1482 | new_client->addr = address; | 1480 | new_client->addr = address; |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 58338ed7c8a1..7c545d5eee45 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -740,11 +740,10 @@ static int adm1031_detect(struct i2c_adapter *adapter, int address, int kind) | |||
740 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 740 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
741 | goto exit; | 741 | goto exit; |
742 | 742 | ||
743 | if (!(data = kmalloc(sizeof(struct adm1031_data), GFP_KERNEL))) { | 743 | if (!(data = kzalloc(sizeof(struct adm1031_data), GFP_KERNEL))) { |
744 | err = -ENOMEM; | 744 | err = -ENOMEM; |
745 | goto exit; | 745 | goto exit; |
746 | } | 746 | } |
747 | memset(data, 0, sizeof(struct adm1031_data)); | ||
748 | 747 | ||
749 | new_client = &data->client; | 748 | new_client = &data->client; |
750 | i2c_set_clientdata(new_client, data); | 749 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 8e34855a6274..52c469722a65 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c | |||
@@ -629,19 +629,17 @@ static int asb100_detect_subclients(struct i2c_adapter *adapter, int address, | |||
629 | int i, id, err; | 629 | int i, id, err; |
630 | struct asb100_data *data = i2c_get_clientdata(new_client); | 630 | struct asb100_data *data = i2c_get_clientdata(new_client); |
631 | 631 | ||
632 | data->lm75[0] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 632 | data->lm75[0] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
633 | if (!(data->lm75[0])) { | 633 | if (!(data->lm75[0])) { |
634 | err = -ENOMEM; | 634 | err = -ENOMEM; |
635 | goto ERROR_SC_0; | 635 | goto ERROR_SC_0; |
636 | } | 636 | } |
637 | memset(data->lm75[0], 0x00, sizeof(struct i2c_client)); | ||
638 | 637 | ||
639 | data->lm75[1] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 638 | data->lm75[1] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
640 | if (!(data->lm75[1])) { | 639 | if (!(data->lm75[1])) { |
641 | err = -ENOMEM; | 640 | err = -ENOMEM; |
642 | goto ERROR_SC_1; | 641 | goto ERROR_SC_1; |
643 | } | 642 | } |
644 | memset(data->lm75[1], 0x00, sizeof(struct i2c_client)); | ||
645 | 643 | ||
646 | id = i2c_adapter_id(adapter); | 644 | id = i2c_adapter_id(adapter); |
647 | 645 | ||
@@ -724,12 +722,11 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) | |||
724 | client structure, even though we cannot fill it completely yet. | 722 | client structure, even though we cannot fill it completely yet. |
725 | But it allows us to access asb100_{read,write}_value. */ | 723 | But it allows us to access asb100_{read,write}_value. */ |
726 | 724 | ||
727 | if (!(data = kmalloc(sizeof(struct asb100_data), GFP_KERNEL))) { | 725 | if (!(data = kzalloc(sizeof(struct asb100_data), GFP_KERNEL))) { |
728 | pr_debug("asb100.o: detect failed, kmalloc failed!\n"); | 726 | pr_debug("asb100.o: detect failed, kzalloc failed!\n"); |
729 | err = -ENOMEM; | 727 | err = -ENOMEM; |
730 | goto ERROR0; | 728 | goto ERROR0; |
731 | } | 729 | } |
732 | memset(data, 0, sizeof(struct asb100_data)); | ||
733 | 730 | ||
734 | new_client = &data->client; | 731 | new_client = &data->client; |
735 | init_MUTEX(&data->lock); | 732 | init_MUTEX(&data->lock); |
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index 441324fc6b8b..53324f56404e 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c | |||
@@ -268,12 +268,11 @@ static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind) | |||
268 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 268 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
269 | goto exit; | 269 | goto exit; |
270 | 270 | ||
271 | if (!(data = kmalloc(sizeof(struct atxp1_data), GFP_KERNEL))) { | 271 | if (!(data = kzalloc(sizeof(struct atxp1_data), GFP_KERNEL))) { |
272 | err = -ENOMEM; | 272 | err = -ENOMEM; |
273 | goto exit; | 273 | goto exit; |
274 | } | 274 | } |
275 | 275 | ||
276 | memset(data, 0, sizeof(struct atxp1_data)); | ||
277 | new_client = &data->client; | 276 | new_client = &data->client; |
278 | i2c_set_clientdata(new_client, data); | 277 | i2c_set_clientdata(new_client, data); |
279 | 278 | ||
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index e1ff22cf984a..c5afa0058308 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
@@ -202,11 +202,10 @@ int ds1621_detect(struct i2c_adapter *adapter, int address, | |||
202 | /* 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 |
203 | client structure, even though we cannot fill it completely yet. | 203 | client structure, even though we cannot fill it completely yet. |
204 | But it allows us to access ds1621_{read,write}_value. */ | 204 | But it allows us to access ds1621_{read,write}_value. */ |
205 | if (!(data = kmalloc(sizeof(struct ds1621_data), GFP_KERNEL))) { | 205 | if (!(data = kzalloc(sizeof(struct ds1621_data), GFP_KERNEL))) { |
206 | err = -ENOMEM; | 206 | err = -ENOMEM; |
207 | goto exit; | 207 | goto exit; |
208 | } | 208 | } |
209 | memset(data, 0, sizeof(struct ds1621_data)); | ||
210 | 209 | ||
211 | new_client = &data->client; | 210 | new_client = &data->client; |
212 | i2c_set_clientdata(new_client, data); | 211 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c index eef6061d786b..a02e1c34c757 100644 --- a/drivers/hwmon/fscher.c +++ b/drivers/hwmon/fscher.c | |||
@@ -303,11 +303,10 @@ static int fscher_detect(struct i2c_adapter *adapter, int address, int kind) | |||
303 | /* OK. For now, we presume we have a valid client. We now create the | 303 | /* OK. For now, we presume we have a valid client. We now create the |
304 | * client structure, even though we cannot fill it completely yet. | 304 | * client structure, even though we cannot fill it completely yet. |
305 | * But it allows us to access i2c_smbus_read_byte_data. */ | 305 | * But it allows us to access i2c_smbus_read_byte_data. */ |
306 | if (!(data = kmalloc(sizeof(struct fscher_data), GFP_KERNEL))) { | 306 | if (!(data = kzalloc(sizeof(struct fscher_data), GFP_KERNEL))) { |
307 | err = -ENOMEM; | 307 | err = -ENOMEM; |
308 | goto exit; | 308 | goto exit; |
309 | } | 309 | } |
310 | memset(data, 0, sizeof(struct fscher_data)); | ||
311 | 310 | ||
312 | /* The common I2C client data is placed right before the | 311 | /* The common I2C client data is placed right before the |
313 | * Hermes-specific data. */ | 312 | * Hermes-specific data. */ |
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c index 5fc77a5fed07..a378e4f5c93b 100644 --- a/drivers/hwmon/fscpos.c +++ b/drivers/hwmon/fscpos.c | |||
@@ -453,11 +453,10 @@ int fscpos_detect(struct i2c_adapter *adapter, int address, int kind) | |||
453 | * But it allows us to access fscpos_{read,write}_value. | 453 | * But it allows us to access fscpos_{read,write}_value. |
454 | */ | 454 | */ |
455 | 455 | ||
456 | if (!(data = kmalloc(sizeof(struct fscpos_data), GFP_KERNEL))) { | 456 | if (!(data = kzalloc(sizeof(struct fscpos_data), GFP_KERNEL))) { |
457 | err = -ENOMEM; | 457 | err = -ENOMEM; |
458 | goto exit; | 458 | goto exit; |
459 | } | 459 | } |
460 | memset(data, 0, sizeof(struct fscpos_data)); | ||
461 | 460 | ||
462 | new_client = &data->client; | 461 | new_client = &data->client; |
463 | i2c_set_clientdata(new_client, data); | 462 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 256b9323c84b..2f178dbe3d87 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c | |||
@@ -365,11 +365,10 @@ static int gl518_detect(struct i2c_adapter *adapter, int address, int kind) | |||
365 | client structure, even though we cannot fill it completely yet. | 365 | client structure, even though we cannot fill it completely yet. |
366 | But it allows us to access gl518_{read,write}_value. */ | 366 | But it allows us to access gl518_{read,write}_value. */ |
367 | 367 | ||
368 | if (!(data = kmalloc(sizeof(struct gl518_data), GFP_KERNEL))) { | 368 | if (!(data = kzalloc(sizeof(struct gl518_data), GFP_KERNEL))) { |
369 | err = -ENOMEM; | 369 | err = -ENOMEM; |
370 | goto exit; | 370 | goto exit; |
371 | } | 371 | } |
372 | memset(data, 0, sizeof(struct gl518_data)); | ||
373 | 372 | ||
374 | new_client = &data->client; | 373 | new_client = &data->client; |
375 | i2c_set_clientdata(new_client, data); | 374 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index 12fd757066fc..c39ba1239426 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c | |||
@@ -536,11 +536,10 @@ static int gl520_detect(struct i2c_adapter *adapter, int address, int kind) | |||
536 | client structure, even though we cannot fill it completely yet. | 536 | client structure, even though we cannot fill it completely yet. |
537 | But it allows us to access gl520_{read,write}_value. */ | 537 | But it allows us to access gl520_{read,write}_value. */ |
538 | 538 | ||
539 | if (!(data = kmalloc(sizeof(struct gl520_data), GFP_KERNEL))) { | 539 | if (!(data = kzalloc(sizeof(struct gl520_data), GFP_KERNEL))) { |
540 | err = -ENOMEM; | 540 | err = -ENOMEM; |
541 | goto exit; | 541 | goto exit; |
542 | } | 542 | } |
543 | memset(data, 0, sizeof(struct gl520_data)); | ||
544 | 543 | ||
545 | new_client = &data->client; | 544 | new_client = &data->client; |
546 | i2c_set_clientdata(new_client, data); | 545 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 55e1c835a046..9a5b8b268397 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -761,11 +761,10 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind) | |||
761 | client structure, even though we cannot fill it completely yet. | 761 | client structure, even though we cannot fill it completely yet. |
762 | But it allows us to access it87_{read,write}_value. */ | 762 | But it allows us to access it87_{read,write}_value. */ |
763 | 763 | ||
764 | if (!(data = kmalloc(sizeof(struct it87_data), GFP_KERNEL))) { | 764 | if (!(data = kzalloc(sizeof(struct it87_data), GFP_KERNEL))) { |
765 | err = -ENOMEM; | 765 | err = -ENOMEM; |
766 | goto ERROR1; | 766 | goto ERROR1; |
767 | } | 767 | } |
768 | memset(data, 0, sizeof(struct it87_data)); | ||
769 | 768 | ||
770 | new_client = &data->client; | 769 | new_client = &data->client; |
771 | if (is_isa) | 770 | if (is_isa) |
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index be5c7095ecbb..954ec2497249 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c | |||
@@ -375,11 +375,10 @@ static int lm63_detect(struct i2c_adapter *adapter, int address, int kind) | |||
375 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 375 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
376 | goto exit; | 376 | goto exit; |
377 | 377 | ||
378 | if (!(data = kmalloc(sizeof(struct lm63_data), GFP_KERNEL))) { | 378 | if (!(data = kzalloc(sizeof(struct lm63_data), GFP_KERNEL))) { |
379 | err = -ENOMEM; | 379 | err = -ENOMEM; |
380 | goto exit; | 380 | goto exit; |
381 | } | 381 | } |
382 | memset(data, 0, sizeof(struct lm63_data)); | ||
383 | 382 | ||
384 | /* The common I2C client data is placed right before the | 383 | /* The common I2C client data is placed right before the |
385 | LM63-specific data. */ | 384 | LM63-specific data. */ |
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 9a3ebdf583f4..d70f4c8fc1e6 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -127,11 +127,10 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind) | |||
127 | /* OK. For now, we presume we have a valid client. We now create the | 127 | /* OK. For now, we presume we have a valid client. We now create the |
128 | client structure, even though we cannot fill it completely yet. | 128 | client structure, even though we cannot fill it completely yet. |
129 | But it allows us to access lm75_{read,write}_value. */ | 129 | But it allows us to access lm75_{read,write}_value. */ |
130 | if (!(data = kmalloc(sizeof(struct lm75_data), GFP_KERNEL))) { | 130 | if (!(data = kzalloc(sizeof(struct lm75_data), GFP_KERNEL))) { |
131 | err = -ENOMEM; | 131 | err = -ENOMEM; |
132 | goto exit; | 132 | goto exit; |
133 | } | 133 | } |
134 | memset(data, 0, sizeof(struct lm75_data)); | ||
135 | 134 | ||
136 | new_client = &data->client; | 135 | new_client = &data->client; |
137 | i2c_set_clientdata(new_client, data); | 136 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c index 866eab96a6f6..9380fda7dcd1 100644 --- a/drivers/hwmon/lm77.c +++ b/drivers/hwmon/lm77.c | |||
@@ -226,11 +226,10 @@ static int lm77_detect(struct i2c_adapter *adapter, int address, int kind) | |||
226 | /* OK. For now, we presume we have a valid client. We now create the | 226 | /* OK. For now, we presume we have a valid client. We now create the |
227 | client structure, even though we cannot fill it completely yet. | 227 | client structure, even though we cannot fill it completely yet. |
228 | But it allows us to access lm77_{read,write}_value. */ | 228 | But it allows us to access lm77_{read,write}_value. */ |
229 | if (!(data = kmalloc(sizeof(struct lm77_data), GFP_KERNEL))) { | 229 | if (!(data = kzalloc(sizeof(struct lm77_data), GFP_KERNEL))) { |
230 | err = -ENOMEM; | 230 | err = -ENOMEM; |
231 | goto exit; | 231 | goto exit; |
232 | } | 232 | } |
233 | memset(data, 0, sizeof(struct lm77_data)); | ||
234 | 233 | ||
235 | new_client = &data->client; | 234 | new_client = &data->client; |
236 | i2c_set_clientdata(new_client, data); | 235 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index d697a554286f..924462362743 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -540,11 +540,10 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) | |||
540 | client structure, even though we cannot fill it completely yet. | 540 | client structure, even though we cannot fill it completely yet. |
541 | But it allows us to access lm78_{read,write}_value. */ | 541 | But it allows us to access lm78_{read,write}_value. */ |
542 | 542 | ||
543 | if (!(data = kmalloc(sizeof(struct lm78_data), GFP_KERNEL))) { | 543 | if (!(data = kzalloc(sizeof(struct lm78_data), GFP_KERNEL))) { |
544 | err = -ENOMEM; | 544 | err = -ENOMEM; |
545 | goto ERROR1; | 545 | goto ERROR1; |
546 | } | 546 | } |
547 | memset(data, 0, sizeof(struct lm78_data)); | ||
548 | 547 | ||
549 | new_client = &data->client; | 548 | new_client = &data->client; |
550 | if (is_isa) | 549 | if (is_isa) |
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index 83af8b3a0cac..b4cd6c661f11 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c | |||
@@ -407,11 +407,10 @@ int lm80_detect(struct i2c_adapter *adapter, int address, int kind) | |||
407 | /* OK. For now, we presume we have a valid client. We now create the | 407 | /* OK. For now, we presume we have a valid client. We now create the |
408 | client structure, even though we cannot fill it completely yet. | 408 | client structure, even though we cannot fill it completely yet. |
409 | But it allows us to access lm80_{read,write}_value. */ | 409 | But it allows us to access lm80_{read,write}_value. */ |
410 | if (!(data = kmalloc(sizeof(struct lm80_data), GFP_KERNEL))) { | 410 | if (!(data = kzalloc(sizeof(struct lm80_data), GFP_KERNEL))) { |
411 | err = -ENOMEM; | 411 | err = -ENOMEM; |
412 | goto exit; | 412 | goto exit; |
413 | } | 413 | } |
414 | memset(data, 0, sizeof(struct lm80_data)); | ||
415 | 414 | ||
416 | new_client = &data->client; | 415 | new_client = &data->client; |
417 | i2c_set_clientdata(new_client, data); | 416 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index d74b2c20c719..9a70611a9f69 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c | |||
@@ -230,11 +230,10 @@ static int lm83_detect(struct i2c_adapter *adapter, int address, int kind) | |||
230 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 230 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
231 | goto exit; | 231 | goto exit; |
232 | 232 | ||
233 | if (!(data = kmalloc(sizeof(struct lm83_data), GFP_KERNEL))) { | 233 | if (!(data = kzalloc(sizeof(struct lm83_data), GFP_KERNEL))) { |
234 | err = -ENOMEM; | 234 | err = -ENOMEM; |
235 | goto exit; | 235 | goto exit; |
236 | } | 236 | } |
237 | memset(data, 0, sizeof(struct lm83_data)); | ||
238 | 237 | ||
239 | /* The common I2C client data is placed right after the | 238 | /* The common I2C client data is placed right after the |
240 | * LM83-specific data. */ | 239 | * LM83-specific data. */ |
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index ab214df9624b..d5537a5377f7 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -1033,11 +1033,10 @@ int lm85_detect(struct i2c_adapter *adapter, int address, | |||
1033 | client structure, even though we cannot fill it completely yet. | 1033 | client structure, even though we cannot fill it completely yet. |
1034 | But it allows us to access lm85_{read,write}_value. */ | 1034 | But it allows us to access lm85_{read,write}_value. */ |
1035 | 1035 | ||
1036 | if (!(data = kmalloc(sizeof(struct lm85_data), GFP_KERNEL))) { | 1036 | if (!(data = kzalloc(sizeof(struct lm85_data), GFP_KERNEL))) { |
1037 | err = -ENOMEM; | 1037 | err = -ENOMEM; |
1038 | goto ERROR0; | 1038 | goto ERROR0; |
1039 | } | 1039 | } |
1040 | memset(data, 0, sizeof(struct lm85_data)); | ||
1041 | 1040 | ||
1042 | new_client = &data->client; | 1041 | new_client = &data->client; |
1043 | i2c_set_clientdata(new_client, data); | 1042 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index dca996de4c33..eeec18177861 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c | |||
@@ -554,11 +554,10 @@ static int lm87_detect(struct i2c_adapter *adapter, int address, int kind) | |||
554 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 554 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
555 | goto exit; | 555 | goto exit; |
556 | 556 | ||
557 | if (!(data = kmalloc(sizeof(struct lm87_data), GFP_KERNEL))) { | 557 | if (!(data = kzalloc(sizeof(struct lm87_data), GFP_KERNEL))) { |
558 | err = -ENOMEM; | 558 | err = -ENOMEM; |
559 | goto exit; | 559 | goto exit; |
560 | } | 560 | } |
561 | memset(data, 0, sizeof(struct lm87_data)); | ||
562 | 561 | ||
563 | /* The common I2C client data is placed right before the | 562 | /* The common I2C client data is placed right before the |
564 | LM87-specific data. */ | 563 | LM87-specific data. */ |
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 14de05fcd431..dad0f1074956 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -370,11 +370,10 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind) | |||
370 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 370 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
371 | goto exit; | 371 | goto exit; |
372 | 372 | ||
373 | if (!(data = kmalloc(sizeof(struct lm90_data), GFP_KERNEL))) { | 373 | if (!(data = kzalloc(sizeof(struct lm90_data), GFP_KERNEL))) { |
374 | err = -ENOMEM; | 374 | err = -ENOMEM; |
375 | goto exit; | 375 | goto exit; |
376 | } | 376 | } |
377 | memset(data, 0, sizeof(struct lm90_data)); | ||
378 | 377 | ||
379 | /* The common I2C client data is placed right before the | 378 | /* The common I2C client data is placed right before the |
380 | LM90-specific data. */ | 379 | LM90-specific data. */ |
diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c index 647b7c7cd575..7a4b3701ed1a 100644 --- a/drivers/hwmon/lm92.c +++ b/drivers/hwmon/lm92.c | |||
@@ -300,11 +300,10 @@ static int lm92_detect(struct i2c_adapter *adapter, int address, int kind) | |||
300 | | I2C_FUNC_SMBUS_WORD_DATA)) | 300 | | I2C_FUNC_SMBUS_WORD_DATA)) |
301 | goto exit; | 301 | goto exit; |
302 | 302 | ||
303 | if (!(data = kmalloc(sizeof(struct lm92_data), GFP_KERNEL))) { | 303 | if (!(data = kzalloc(sizeof(struct lm92_data), GFP_KERNEL))) { |
304 | err = -ENOMEM; | 304 | err = -ENOMEM; |
305 | goto exit; | 305 | goto exit; |
306 | } | 306 | } |
307 | memset(data, 0, sizeof(struct lm92_data)); | ||
308 | 307 | ||
309 | /* Fill in enough client fields so that we can read from the chip, | 308 | /* Fill in enough client fields so that we can read from the chip, |
310 | which is required for identication */ | 309 | which is required for identication */ |
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index 16bf71f3a04d..6a82ffae1bfd 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c | |||
@@ -197,11 +197,10 @@ static int max1619_detect(struct i2c_adapter *adapter, int address, int kind) | |||
197 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 197 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
198 | goto exit; | 198 | goto exit; |
199 | 199 | ||
200 | if (!(data = kmalloc(sizeof(struct max1619_data), GFP_KERNEL))) { | 200 | if (!(data = kzalloc(sizeof(struct max1619_data), GFP_KERNEL))) { |
201 | err = -ENOMEM; | 201 | err = -ENOMEM; |
202 | goto exit; | 202 | goto exit; |
203 | } | 203 | } |
204 | memset(data, 0, sizeof(struct max1619_data)); | ||
205 | 204 | ||
206 | /* The common I2C client data is placed right before the | 205 | /* The common I2C client data is placed right before the |
207 | MAX1619-specific data. */ | 206 | MAX1619-specific data. */ |
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index cf2a35799c7c..17f745a23d04 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
@@ -754,9 +754,8 @@ static int pc87360_detect(struct i2c_adapter *adapter) | |||
754 | const char *name = "pc87360"; | 754 | const char *name = "pc87360"; |
755 | int use_thermistors = 0; | 755 | int use_thermistors = 0; |
756 | 756 | ||
757 | if (!(data = kmalloc(sizeof(struct pc87360_data), GFP_KERNEL))) | 757 | if (!(data = kzalloc(sizeof(struct pc87360_data), GFP_KERNEL))) |
758 | return -ENOMEM; | 758 | return -ENOMEM; |
759 | memset(data, 0x00, sizeof(struct pc87360_data)); | ||
760 | 759 | ||
761 | new_client = &data->client; | 760 | new_client = &data->client; |
762 | i2c_set_clientdata(new_client, data); | 761 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 21aa9a41f62c..9c6cadec1087 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c | |||
@@ -518,11 +518,10 @@ static int sis5595_detect(struct i2c_adapter *adapter) | |||
518 | goto exit_release; | 518 | goto exit_release; |
519 | } | 519 | } |
520 | 520 | ||
521 | if (!(data = kmalloc(sizeof(struct sis5595_data), GFP_KERNEL))) { | 521 | if (!(data = kzalloc(sizeof(struct sis5595_data), GFP_KERNEL))) { |
522 | err = -ENOMEM; | 522 | err = -ENOMEM; |
523 | goto exit_release; | 523 | goto exit_release; |
524 | } | 524 | } |
525 | memset(data, 0, sizeof(struct sis5595_data)); | ||
526 | 525 | ||
527 | new_client = &data->client; | 526 | new_client = &data->client; |
528 | new_client->addr = address; | 527 | new_client->addr = address; |
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index 37ed8b33f01a..2a3e21b5b6b4 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
@@ -244,11 +244,10 @@ static int smsc47b397_detect(struct i2c_adapter *adapter) | |||
244 | return -EBUSY; | 244 | return -EBUSY; |
245 | } | 245 | } |
246 | 246 | ||
247 | if (!(data = kmalloc(sizeof(struct smsc47b397_data), GFP_KERNEL))) { | 247 | if (!(data = kzalloc(sizeof(struct smsc47b397_data), GFP_KERNEL))) { |
248 | err = -ENOMEM; | 248 | err = -ENOMEM; |
249 | goto error_release; | 249 | goto error_release; |
250 | } | 250 | } |
251 | memset(data, 0x00, sizeof(struct smsc47b397_data)); | ||
252 | 251 | ||
253 | new_client = &data->client; | 252 | new_client = &data->client; |
254 | i2c_set_clientdata(new_client, data); | 253 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index c9cc683eba4a..bbe93a0688ec 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -396,11 +396,10 @@ static int smsc47m1_detect(struct i2c_adapter *adapter) | |||
396 | return -EBUSY; | 396 | return -EBUSY; |
397 | } | 397 | } |
398 | 398 | ||
399 | if (!(data = kmalloc(sizeof(struct smsc47m1_data), GFP_KERNEL))) { | 399 | if (!(data = kzalloc(sizeof(struct smsc47m1_data), GFP_KERNEL))) { |
400 | err = -ENOMEM; | 400 | err = -ENOMEM; |
401 | goto error_release; | 401 | goto error_release; |
402 | } | 402 | } |
403 | memset(data, 0x00, sizeof(struct smsc47m1_data)); | ||
404 | 403 | ||
405 | new_client = &data->client; | 404 | new_client = &data->client; |
406 | i2c_set_clientdata(new_client, data); | 405 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index c6e64f4abdea..6f696f897176 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c | |||
@@ -621,11 +621,10 @@ static int via686a_detect(struct i2c_adapter *adapter) | |||
621 | return -ENODEV; | 621 | return -ENODEV; |
622 | } | 622 | } |
623 | 623 | ||
624 | if (!(data = kmalloc(sizeof(struct via686a_data), GFP_KERNEL))) { | 624 | if (!(data = kzalloc(sizeof(struct via686a_data), GFP_KERNEL))) { |
625 | err = -ENOMEM; | 625 | err = -ENOMEM; |
626 | goto exit_release; | 626 | goto exit_release; |
627 | } | 627 | } |
628 | memset(data, 0, sizeof(struct via686a_data)); | ||
629 | 628 | ||
630 | new_client = &data->client; | 629 | new_client = &data->client; |
631 | i2c_set_clientdata(new_client, data); | 630 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 685eeb766809..eee22a57e929 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -681,11 +681,10 @@ static int w83627ehf_detect(struct i2c_adapter *adapter) | |||
681 | goto exit; | 681 | goto exit; |
682 | } | 682 | } |
683 | 683 | ||
684 | if (!(data = kmalloc(sizeof(struct w83627ehf_data), GFP_KERNEL))) { | 684 | if (!(data = kzalloc(sizeof(struct w83627ehf_data), GFP_KERNEL))) { |
685 | err = -ENOMEM; | 685 | err = -ENOMEM; |
686 | goto exit_release; | 686 | goto exit_release; |
687 | } | 687 | } |
688 | memset(data, 0, sizeof(struct w83627ehf_data)); | ||
689 | 688 | ||
690 | client = &data->client; | 689 | client = &data->client; |
691 | i2c_set_clientdata(client, data); | 690 | i2c_set_clientdata(client, data); |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 48270819ff99..70ef926c3bd8 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -1045,11 +1045,10 @@ static int w83627hf_detect(struct i2c_adapter *adapter) | |||
1045 | client structure, even though we cannot fill it completely yet. | 1045 | client structure, even though we cannot fill it completely yet. |
1046 | But it allows us to access w83627hf_{read,write}_value. */ | 1046 | But it allows us to access w83627hf_{read,write}_value. */ |
1047 | 1047 | ||
1048 | if (!(data = kmalloc(sizeof(struct w83627hf_data), GFP_KERNEL))) { | 1048 | if (!(data = kzalloc(sizeof(struct w83627hf_data), GFP_KERNEL))) { |
1049 | err = -ENOMEM; | 1049 | err = -ENOMEM; |
1050 | goto ERROR1; | 1050 | goto ERROR1; |
1051 | } | 1051 | } |
1052 | memset(data, 0, sizeof(struct w83627hf_data)); | ||
1053 | 1052 | ||
1054 | new_client = &data->client; | 1053 | new_client = &data->client; |
1055 | i2c_set_clientdata(new_client, data); | 1054 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index 26b1fac7c619..9265f32122fa 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c | |||
@@ -889,12 +889,11 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind, | |||
889 | const char *client_name = ""; | 889 | const char *client_name = ""; |
890 | struct w83781d_data *data = i2c_get_clientdata(new_client); | 890 | struct w83781d_data *data = i2c_get_clientdata(new_client); |
891 | 891 | ||
892 | data->lm75[0] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 892 | data->lm75[0] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
893 | if (!(data->lm75[0])) { | 893 | if (!(data->lm75[0])) { |
894 | err = -ENOMEM; | 894 | err = -ENOMEM; |
895 | goto ERROR_SC_0; | 895 | goto ERROR_SC_0; |
896 | } | 896 | } |
897 | memset(data->lm75[0], 0x00, sizeof (struct i2c_client)); | ||
898 | 897 | ||
899 | id = i2c_adapter_id(adapter); | 898 | id = i2c_adapter_id(adapter); |
900 | 899 | ||
@@ -919,13 +918,11 @@ w83781d_detect_subclients(struct i2c_adapter *adapter, int address, int kind, | |||
919 | } | 918 | } |
920 | 919 | ||
921 | if (kind != w83783s) { | 920 | if (kind != w83783s) { |
922 | 921 | data->lm75[1] = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); | |
923 | data->lm75[1] = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | ||
924 | if (!(data->lm75[1])) { | 922 | if (!(data->lm75[1])) { |
925 | err = -ENOMEM; | 923 | err = -ENOMEM; |
926 | goto ERROR_SC_1; | 924 | goto ERROR_SC_1; |
927 | } | 925 | } |
928 | memset(data->lm75[1], 0x0, sizeof(struct i2c_client)); | ||
929 | 926 | ||
930 | if (force_subclients[0] == id && | 927 | if (force_subclients[0] == id && |
931 | force_subclients[1] == address) { | 928 | force_subclients[1] == address) { |
@@ -1064,11 +1061,10 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1064 | client structure, even though we cannot fill it completely yet. | 1061 | client structure, even though we cannot fill it completely yet. |
1065 | But it allows us to access w83781d_{read,write}_value. */ | 1062 | But it allows us to access w83781d_{read,write}_value. */ |
1066 | 1063 | ||
1067 | if (!(data = kmalloc(sizeof(struct w83781d_data), GFP_KERNEL))) { | 1064 | if (!(data = kzalloc(sizeof(struct w83781d_data), GFP_KERNEL))) { |
1068 | err = -ENOMEM; | 1065 | err = -ENOMEM; |
1069 | goto ERROR1; | 1066 | goto ERROR1; |
1070 | } | 1067 | } |
1071 | memset(data, 0, sizeof(struct w83781d_data)); | ||
1072 | 1068 | ||
1073 | new_client = &data->client; | 1069 | new_client = &data->client; |
1074 | i2c_set_clientdata(new_client, data); | 1070 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index 7bbd1888ce94..4be59dbb78c4 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c | |||
@@ -1086,11 +1086,10 @@ w83792d_create_subclient(struct i2c_adapter *adapter, | |||
1086 | int err; | 1086 | int err; |
1087 | struct i2c_client *sub_client; | 1087 | struct i2c_client *sub_client; |
1088 | 1088 | ||
1089 | (*sub_cli) = sub_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 1089 | (*sub_cli) = sub_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); |
1090 | if (!(sub_client)) { | 1090 | if (!(sub_client)) { |
1091 | return -ENOMEM; | 1091 | return -ENOMEM; |
1092 | } | 1092 | } |
1093 | memset(sub_client, 0x00, sizeof(struct i2c_client)); | ||
1094 | sub_client->addr = 0x48 + addr; | 1093 | sub_client->addr = 0x48 + addr; |
1095 | i2c_set_clientdata(sub_client, NULL); | 1094 | i2c_set_clientdata(sub_client, NULL); |
1096 | sub_client->adapter = adapter; | 1095 | sub_client->adapter = adapter; |
@@ -1184,11 +1183,10 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1184 | client structure, even though we cannot fill it completely yet. | 1183 | client structure, even though we cannot fill it completely yet. |
1185 | But it allows us to access w83792d_{read,write}_value. */ | 1184 | But it allows us to access w83792d_{read,write}_value. */ |
1186 | 1185 | ||
1187 | if (!(data = kmalloc(sizeof(struct w83792d_data), GFP_KERNEL))) { | 1186 | if (!(data = kzalloc(sizeof(struct w83792d_data), GFP_KERNEL))) { |
1188 | err = -ENOMEM; | 1187 | err = -ENOMEM; |
1189 | goto ERROR0; | 1188 | goto ERROR0; |
1190 | } | 1189 | } |
1191 | memset(data, 0, sizeof(struct w83792d_data)); | ||
1192 | 1190 | ||
1193 | new_client = &data->client; | 1191 | new_client = &data->client; |
1194 | i2c_set_clientdata(new_client, data); | 1192 | i2c_set_clientdata(new_client, data); |
diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index db12a620b331..f495b6378668 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c | |||
@@ -156,12 +156,10 @@ static int w83l785ts_detect(struct i2c_adapter *adapter, int address, int kind) | |||
156 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 156 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
157 | goto exit; | 157 | goto exit; |
158 | 158 | ||
159 | if (!(data = kmalloc(sizeof(struct w83l785ts_data), GFP_KERNEL))) { | 159 | if (!(data = kzalloc(sizeof(struct w83l785ts_data), GFP_KERNEL))) { |
160 | err = -ENOMEM; | 160 | err = -ENOMEM; |
161 | goto exit; | 161 | goto exit; |
162 | } | 162 | } |
163 | memset(data, 0, sizeof(struct w83l785ts_data)); | ||
164 | |||
165 | 163 | ||
166 | /* The common I2C client data is placed right before the | 164 | /* The common I2C client data is placed right before the |
167 | * W83L785TS-specific data. */ | 165 | * W83L785TS-specific data. */ |