Re: [PATCH] request_firmware(): fixes and polishing.

From: Manuel Estrada Sainz
Date: Tue Feb 24 2004 - 20:38:54 EST


Based on patch and suggestions from Dmitry Torokhov

Changelog:
- 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.

Index: linux-2.5/drivers/base/firmware_class.c
===================================================================
--- linux-2.5.orig/drivers/base/firmware_class.c 2004-01-02 20:42:03.000000000 +0100
+++ linux-2.5/drivers/base/firmware_class.c 2004-01-02 21:43:17.000000000 +0100
@@ -119,7 +119,7 @@
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 @@
}
memset(fw_priv->fw, 0, sizeof (*fw_priv->fw));

+ *class_dev_p = class_dev;
goto out;

error_remove_loading:
@@ -310,7 +311,6 @@
kfree(class_dev);
*class_dev_p = NULL;
out:
- *class_dev_p = class_dev;
return retval;
}
static void
@@ -489,6 +489,7 @@
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) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/