diff options
Diffstat (limited to 'drivers/base/firmware_class.c')
-rw-r--r-- | drivers/base/firmware_class.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 5bfa2e9a7c26..4acb2c5733c3 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -301,9 +301,9 @@ fw_register_class_device(struct class_device **class_dev_p, | |||
301 | const char *fw_name, struct device *device) | 301 | const char *fw_name, struct device *device) |
302 | { | 302 | { |
303 | int retval; | 303 | int retval; |
304 | struct firmware_priv *fw_priv = kmalloc(sizeof (struct firmware_priv), | 304 | struct firmware_priv *fw_priv = kzalloc(sizeof(*fw_priv), |
305 | GFP_KERNEL); | 305 | GFP_KERNEL); |
306 | struct class_device *class_dev = kmalloc(sizeof (struct class_device), | 306 | struct class_device *class_dev = kzalloc(sizeof(*class_dev), |
307 | GFP_KERNEL); | 307 | GFP_KERNEL); |
308 | 308 | ||
309 | *class_dev_p = NULL; | 309 | *class_dev_p = NULL; |
@@ -313,8 +313,6 @@ fw_register_class_device(struct class_device **class_dev_p, | |||
313 | retval = -ENOMEM; | 313 | retval = -ENOMEM; |
314 | goto error_kfree; | 314 | goto error_kfree; |
315 | } | 315 | } |
316 | memset(fw_priv, 0, sizeof (*fw_priv)); | ||
317 | memset(class_dev, 0, sizeof (*class_dev)); | ||
318 | 316 | ||
319 | init_completion(&fw_priv->completion); | 317 | init_completion(&fw_priv->completion); |
320 | fw_priv->attr_data = firmware_attr_data_tmpl; | 318 | fw_priv->attr_data = firmware_attr_data_tmpl; |
@@ -402,14 +400,13 @@ _request_firmware(const struct firmware **firmware_p, const char *name, | |||
402 | if (!firmware_p) | 400 | if (!firmware_p) |
403 | return -EINVAL; | 401 | return -EINVAL; |
404 | 402 | ||
405 | *firmware_p = firmware = kmalloc(sizeof (struct firmware), GFP_KERNEL); | 403 | *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); |
406 | if (!firmware) { | 404 | if (!firmware) { |
407 | printk(KERN_ERR "%s: kmalloc(struct firmware) failed\n", | 405 | printk(KERN_ERR "%s: kmalloc(struct firmware) failed\n", |
408 | __FUNCTION__); | 406 | __FUNCTION__); |
409 | retval = -ENOMEM; | 407 | retval = -ENOMEM; |
410 | goto out; | 408 | goto out; |
411 | } | 409 | } |
412 | memset(firmware, 0, sizeof (*firmware)); | ||
413 | 410 | ||
414 | retval = fw_setup_class_device(firmware, &class_dev, name, device, | 411 | retval = fw_setup_class_device(firmware, &class_dev, name, device, |
415 | hotplug); | 412 | hotplug); |