Commit 8ba2e802 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] request_firmware(): fix attribute removal

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

Based on patch and suggestions from Dmitry Torokhov

- Don't remove attributes, they should be gone automatically.
parent c88ec5ad
...@@ -339,13 +339,13 @@ fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p, ...@@ -339,13 +339,13 @@ fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p,
goto out; goto out;
fw_priv = class_get_devdata(class_dev); fw_priv = class_get_devdata(class_dev);
fw_priv->fw = fw;
fw_priv->fw = fw;
retval = sysfs_create_bin_file(&class_dev->kobj, &fw_priv->attr_data); retval = sysfs_create_bin_file(&class_dev->kobj, &fw_priv->attr_data);
if (retval) { if (retval) {
printk(KERN_ERR "%s: sysfs_create_bin_file failed\n", printk(KERN_ERR "%s: sysfs_create_bin_file failed\n",
__FUNCTION__); __FUNCTION__);
goto error_unreg_class_dev; goto error_unreg;
} }
retval = class_device_create_file(class_dev, retval = class_device_create_file(class_dev,
...@@ -353,28 +353,17 @@ fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p, ...@@ -353,28 +353,17 @@ fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p,
if (retval) { if (retval) {
printk(KERN_ERR "%s: class_device_create_file failed\n", printk(KERN_ERR "%s: class_device_create_file failed\n",
__FUNCTION__); __FUNCTION__);
goto error_remove_data; goto error_unreg;
} }
*class_dev_p = class_dev; *class_dev_p = class_dev;
goto out; goto out;
error_remove_data: error_unreg:
sysfs_remove_bin_file(&class_dev->kobj, &fw_priv->attr_data);
error_unreg_class_dev:
class_device_unregister(class_dev); class_device_unregister(class_dev);
out: out:
return retval; return retval;
} }
static void
fw_remove_class_device(struct class_device *class_dev)
{
struct firmware_priv *fw_priv = class_get_devdata(class_dev);
class_device_remove_file(class_dev, &class_device_attr_loading);
sysfs_remove_bin_file(&class_dev->kobj, &fw_priv->attr_data);
class_device_unregister(class_dev);
}
/** /**
* request_firmware: - request firmware to hotplug and wait for it * request_firmware: - request firmware to hotplug and wait for it
...@@ -433,7 +422,7 @@ request_firmware(const struct firmware **firmware_p, const char *name, ...@@ -433,7 +422,7 @@ request_firmware(const struct firmware **firmware_p, const char *name,
} }
fw_priv->fw = NULL; fw_priv->fw = NULL;
up(&fw_lock); up(&fw_lock);
fw_remove_class_device(class_dev); class_device_unregister(class_dev);
goto out; goto out;
error_kfree_fw: error_kfree_fw:
...@@ -569,7 +558,6 @@ firmware_class_init(void) ...@@ -569,7 +558,6 @@ firmware_class_init(void)
static void __exit static void __exit
firmware_class_exit(void) firmware_class_exit(void)
{ {
class_remove_file(&firmware_class, &class_attr_timeout);
class_unregister(&firmware_class); class_unregister(&firmware_class);
} }
......
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