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,
complete(&fw_priv->completion);
break;
case 1:
kfree(fw_priv->fw->data);
vfree(fw_priv->fw->data);
fw_priv->fw->data = NULL;
fw_priv->fw->size = 0;
fw_priv->alloc_size = 0;
......@@ -297,6 +297,7 @@ fw_setup_class_device(struct class_device **class_dev_p,
}
memset(fw_priv->fw, 0, sizeof (*fw_priv->fw));
*class_dev_p = class_dev;
goto out;
error_remove_loading:
......@@ -310,7 +311,6 @@ fw_setup_class_device(struct class_device **class_dev_p,
kfree(class_dev);
*class_dev_p = NULL;
out:
*class_dev_p = class_dev;
return retval;
}
static void
......@@ -489,6 +489,7 @@ firmware_class_init(void)
error = class_register(&firmware_class);
if (error) {
printk(KERN_ERR "%s: class_register failed\n", __FUNCTION__);
return error;
}
error = class_create_file(&firmware_class, &class_attr_timeout);
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