aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips
diff options
context:
space:
mode:
authorDeepak Saxena <dsaxena@plexity.net>2005-10-17 17:09:43 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 17:02:12 -0400
commit5263ebb51eb098b01caf229498c954999117e4a7 (patch)
treef18933c0b38a51ba9f100e7be4f5f5d54838cf45 /drivers/i2c/chips
parentba9c2e8d15da029ea3051c95e446b2d638ef02e2 (diff)
[PATCH] i2c: kzalloc conversion, other drivers
Use kzalloc instead of kmalloc+memset in all remaining i2c bus and chip 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/i2c/chips')
-rw-r--r--drivers/i2c/chips/ds1337.c3
-rw-r--r--drivers/i2c/chips/ds1374.c3
-rw-r--r--drivers/i2c/chips/eeprom.c3
-rw-r--r--drivers/i2c/chips/m41t00.c3
-rw-r--r--drivers/i2c/chips/max6875.c6
-rw-r--r--drivers/i2c/chips/pca9539.c3
-rw-r--r--drivers/i2c/chips/pcf8574.c3
-rw-r--r--drivers/i2c/chips/pcf8591.c3
-rw-r--r--drivers/i2c/chips/rtc8564.c3
-rw-r--r--drivers/i2c/chips/tps65010.c3
10 files changed, 11 insertions, 22 deletions
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c
index 9d3175c03395..01b037007410 100644
--- a/drivers/i2c/chips/ds1337.c
+++ b/drivers/i2c/chips/ds1337.c
@@ -243,11 +243,10 @@ static int ds1337_detect(struct i2c_adapter *adapter, int address, int kind)
243 I2C_FUNC_I2C)) 243 I2C_FUNC_I2C))
244 goto exit; 244 goto exit;
245 245
246 if (!(data = kmalloc(sizeof(struct ds1337_data), GFP_KERNEL))) { 246 if (!(data = kzalloc(sizeof(struct ds1337_data), GFP_KERNEL))) {
247 err = -ENOMEM; 247 err = -ENOMEM;
248 goto exit; 248 goto exit;
249 } 249 }
250 memset(data, 0, sizeof(struct ds1337_data));
251 INIT_LIST_HEAD(&data->list); 250 INIT_LIST_HEAD(&data->list);
252 251
253 /* The common I2C client data is placed right before the 252 /* The common I2C client data is placed right before the
diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c
index ec640e9f085a..1596e6478782 100644
--- a/drivers/i2c/chips/ds1374.c
+++ b/drivers/i2c/chips/ds1374.c
@@ -193,11 +193,10 @@ static int ds1374_probe(struct i2c_adapter *adap, int addr, int kind)
193 struct i2c_client *client; 193 struct i2c_client *client;
194 int rc; 194 int rc;
195 195
196 client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 196 client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
197 if (!client) 197 if (!client)
198 return -ENOMEM; 198 return -ENOMEM;
199 199
200 memset(client, 0, sizeof(struct i2c_client));
201 strncpy(client->name, DS1374_DRV_NAME, I2C_NAME_SIZE); 200 strncpy(client->name, DS1374_DRV_NAME, I2C_NAME_SIZE);
202 client->addr = addr; 201 client->addr = addr;
203 client->adapter = adap; 202 client->adapter = adap;
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
index 7fb739c43935..ee7cbc823fd1 100644
--- a/drivers/i2c/chips/eeprom.c
+++ b/drivers/i2c/chips/eeprom.c
@@ -171,11 +171,10 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
171 | I2C_FUNC_SMBUS_BYTE)) 171 | I2C_FUNC_SMBUS_BYTE))
172 goto exit; 172 goto exit;
173 173
174 if (!(data = kmalloc(sizeof(struct eeprom_data), GFP_KERNEL))) { 174 if (!(data = kzalloc(sizeof(struct eeprom_data), GFP_KERNEL))) {
175 err = -ENOMEM; 175 err = -ENOMEM;
176 goto exit; 176 goto exit;
177 } 177 }
178 memset(data, 0, sizeof(struct eeprom_data));
179 178
180 new_client = &data->client; 179 new_client = &data->client;
181 memset(data->data, 0xff, EEPROM_SIZE); 180 memset(data->data, 0xff, EEPROM_SIZE);
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c
index 554f7ba61627..3df309ae44a6 100644
--- a/drivers/i2c/chips/m41t00.c
+++ b/drivers/i2c/chips/m41t00.c
@@ -174,11 +174,10 @@ m41t00_probe(struct i2c_adapter *adap, int addr, int kind)
174 struct i2c_client *client; 174 struct i2c_client *client;
175 int rc; 175 int rc;
176 176
177 client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 177 client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
178 if (!client) 178 if (!client)
179 return -ENOMEM; 179 return -ENOMEM;
180 180
181 memset(client, 0, sizeof(struct i2c_client));
182 strncpy(client->name, M41T00_DRV_NAME, I2C_NAME_SIZE); 181 strncpy(client->name, M41T00_DRV_NAME, I2C_NAME_SIZE);
183 client->addr = addr; 182 client->addr = addr;
184 client->adapter = adap; 183 client->adapter = adap;
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c
index 9e1aeb69abf9..b376a006883c 100644
--- a/drivers/i2c/chips/max6875.c
+++ b/drivers/i2c/chips/max6875.c
@@ -179,16 +179,14 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind)
179 if (address & 1) 179 if (address & 1)
180 return 0; 180 return 0;
181 181
182 if (!(data = kmalloc(sizeof(struct max6875_data), GFP_KERNEL))) 182 if (!(data = kzalloc(sizeof(struct max6875_data), GFP_KERNEL)))
183 return -ENOMEM; 183 return -ENOMEM;
184 memset(data, 0, sizeof(struct max6875_data));
185 184
186 /* A fake client is created on the odd address */ 185 /* A fake client is created on the odd address */
187 if (!(fake_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL))) { 186 if (!(fake_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL))) {
188 err = -ENOMEM; 187 err = -ENOMEM;
189 goto exit_kfree1; 188 goto exit_kfree1;
190 } 189 }
191 memset(fake_client, 0, sizeof(struct i2c_client));
192 190
193 /* Init real i2c_client */ 191 /* Init real i2c_client */
194 real_client = &data->client; 192 real_client = &data->client;
diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c
index 225577fdda4d..59a930346229 100644
--- a/drivers/i2c/chips/pca9539.c
+++ b/drivers/i2c/chips/pca9539.c
@@ -122,11 +122,10 @@ static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind)
122 122
123 /* OK. For now, we presume we have a valid client. We now create the 123 /* OK. For now, we presume we have a valid client. We now create the
124 client structure, even though we cannot fill it completely yet. */ 124 client structure, even though we cannot fill it completely yet. */
125 if (!(data = kmalloc(sizeof(struct pca9539_data), GFP_KERNEL))) { 125 if (!(data = kzalloc(sizeof(struct pca9539_data), GFP_KERNEL))) {
126 err = -ENOMEM; 126 err = -ENOMEM;
127 goto exit; 127 goto exit;
128 } 128 }
129 memset(data, 0, sizeof(struct pca9539_data));
130 129
131 new_client = &data->client; 130 new_client = &data->client;
132 i2c_set_clientdata(new_client, data); 131 i2c_set_clientdata(new_client, data);
diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c
index 6525743ff9fd..2c2555d46fdf 100644
--- a/drivers/i2c/chips/pcf8574.c
+++ b/drivers/i2c/chips/pcf8574.c
@@ -127,11 +127,10 @@ int pcf8574_detect(struct i2c_adapter *adapter, int address, int kind)
127 127
128 /* OK. For now, we presume we have a valid client. We now create the 128 /* OK. For now, we presume we have a valid client. We now create the
129 client structure, even though we cannot fill it completely yet. */ 129 client structure, even though we cannot fill it completely yet. */
130 if (!(data = kmalloc(sizeof(struct pcf8574_data), GFP_KERNEL))) { 130 if (!(data = kzalloc(sizeof(struct pcf8574_data), GFP_KERNEL))) {
131 err = -ENOMEM; 131 err = -ENOMEM;
132 goto exit; 132 goto exit;
133 } 133 }
134 memset(data, 0, sizeof(struct pcf8574_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/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c
index 80f1df9a4500..3c815b153249 100644
--- a/drivers/i2c/chips/pcf8591.c
+++ b/drivers/i2c/chips/pcf8591.c
@@ -178,11 +178,10 @@ int pcf8591_detect(struct i2c_adapter *adapter, int address, int kind)
178 178
179 /* OK. For now, we presume we have a valid client. We now create the 179 /* OK. For now, we presume we have a valid client. We now create the
180 client structure, even though we cannot fill it completely yet. */ 180 client structure, even though we cannot fill it completely yet. */
181 if (!(data = kmalloc(sizeof(struct pcf8591_data), GFP_KERNEL))) { 181 if (!(data = kzalloc(sizeof(struct pcf8591_data), GFP_KERNEL))) {
182 err = -ENOMEM; 182 err = -ENOMEM;
183 goto exit; 183 goto exit;
184 } 184 }
185 memset(data, 0, sizeof(struct pcf8591_data));
186 185
187 new_client = &data->client; 186 new_client = &data->client;
188 i2c_set_clientdata(new_client, data); 187 i2c_set_clientdata(new_client, data);
diff --git a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c
index dd9d42d7b6e7..916cdc1af23c 100644
--- a/drivers/i2c/chips/rtc8564.c
+++ b/drivers/i2c/chips/rtc8564.c
@@ -148,12 +148,11 @@ static int rtc8564_attach(struct i2c_adapter *adap, int addr, int kind)
148 {addr, I2C_M_RD, 2, data} 148 {addr, I2C_M_RD, 2, data}
149 }; 149 };
150 150
151 d = kmalloc(sizeof(struct rtc8564_data), GFP_KERNEL); 151 d = kzalloc(sizeof(struct rtc8564_data), GFP_KERNEL);
152 if (!d) { 152 if (!d) {
153 ret = -ENOMEM; 153 ret = -ENOMEM;
154 goto done; 154 goto done;
155 } 155 }
156 memset(d, 0, sizeof(struct rtc8564_data));
157 new_client = &d->client; 156 new_client = &d->client;
158 157
159 strlcpy(new_client->name, "RTC8564", I2C_NAME_SIZE); 158 strlcpy(new_client->name, "RTC8564", I2C_NAME_SIZE);
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c
index 280e9638c0f8..280dd7a45db6 100644
--- a/drivers/i2c/chips/tps65010.c
+++ b/drivers/i2c/chips/tps65010.c
@@ -500,11 +500,10 @@ tps65010_probe(struct i2c_adapter *bus, int address, int kind)
500 return 0; 500 return 0;
501 } 501 }
502 502
503 tps = kmalloc(sizeof *tps, GFP_KERNEL); 503 tps = kzalloc(sizeof *tps, GFP_KERNEL);
504 if (!tps) 504 if (!tps)
505 return 0; 505 return 0;
506 506
507 memset(tps, 0, sizeof *tps);
508 init_MUTEX(&tps->lock); 507 init_MUTEX(&tps->lock);
509 INIT_WORK(&tps->work, tps65010_work, tps); 508 INIT_WORK(&tps->work, tps65010_work, tps);
510 tps->irq = -1; 509 tps->irq = -1;