Commit 6a2ea2b8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] request_firmware(): misc fixes

From: Manuel Estrada Sainz <ranty@ranty.pantax.net>

Based on patch and suggestions from Dmitry Torokhov

- use vfree to free vmalloc memory.

- Make sure fw_setup_class_device sets *class_dev_p to NULL in all case of
  error.

- Fix error handling in firmware_class_init.
parent 9bf6f993
...@@ -119,7 +119,7 @@ firmware_loading_store(struct class_device *class_dev, ...@@ -119,7 +119,7 @@ firmware_loading_store(struct class_device *class_dev,
complete(&fw_priv->completion); complete(&fw_priv->completion);
break; break;
case 1: case 1:
kfree(fw_priv->fw->data); vfree(fw_priv->fw->data);
fw_priv->fw->data = NULL; fw_priv->fw->data = NULL;
fw_priv->fw->size = 0; fw_priv->fw->size = 0;
fw_priv->alloc_size = 0; fw_priv->alloc_size = 0;
...@@ -297,6 +297,7 @@ fw_setup_class_device(struct class_device **class_dev_p, ...@@ -297,6 +297,7 @@ fw_setup_class_device(struct class_device **class_dev_p,
} }
memset(fw_priv->fw, 0, sizeof (*fw_priv->fw)); memset(fw_priv->fw, 0, sizeof (*fw_priv->fw));
*class_dev_p = class_dev;
goto out; goto out;
error_remove_loading: error_remove_loading:
...@@ -310,7 +311,6 @@ fw_setup_class_device(struct class_device **class_dev_p, ...@@ -310,7 +311,6 @@ fw_setup_class_device(struct class_device **class_dev_p,
kfree(class_dev); kfree(class_dev);
*class_dev_p = NULL; *class_dev_p = NULL;
out: out:
*class_dev_p = class_dev;
return retval; return retval;
} }
static void static void
...@@ -489,6 +489,7 @@ firmware_class_init(void) ...@@ -489,6 +489,7 @@ firmware_class_init(void)
error = class_register(&firmware_class); error = class_register(&firmware_class);
if (error) { if (error) {
printk(KERN_ERR "%s: class_register failed\n", __FUNCTION__); printk(KERN_ERR "%s: class_register failed\n", __FUNCTION__);
return error;
} }
error = class_create_file(&firmware_class, &class_attr_timeout); error = class_create_file(&firmware_class, &class_attr_timeout);
if (error) { if (error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment