aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/firmware_class.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index c378a355bed4..d98e424675cf 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -86,7 +86,6 @@ static int loading_timeout = 60; /* In seconds */
86static DEFINE_MUTEX(fw_lock); 86static DEFINE_MUTEX(fw_lock);
87 87
88struct firmware_priv { 88struct firmware_priv {
89 char *fw_id;
90 struct completion completion; 89 struct completion completion;
91 struct bin_attribute attr_data; 90 struct bin_attribute attr_data;
92 struct firmware *fw; 91 struct firmware *fw;
@@ -94,9 +93,9 @@ struct firmware_priv {
94 struct page **pages; 93 struct page **pages;
95 int nr_pages; 94 int nr_pages;
96 int page_array_size; 95 int page_array_size;
97 const char *vdata;
98 struct timer_list timeout; 96 struct timer_list timeout;
99 bool nowait; 97 bool nowait;
98 char fw_id[];
100}; 99};
101 100
102static void 101static void
@@ -153,7 +152,6 @@ static void fw_dev_release(struct device *dev)
153 for (i = 0; i < fw_priv->nr_pages; i++) 152 for (i = 0; i < fw_priv->nr_pages; i++)
154 __free_page(fw_priv->pages[i]); 153 __free_page(fw_priv->pages[i]);
155 kfree(fw_priv->pages); 154 kfree(fw_priv->pages);
156 kfree(fw_priv->fw_id);
157 kfree(fw_priv); 155 kfree(fw_priv);
158 kfree(dev); 156 kfree(dev);
159 157
@@ -437,8 +435,8 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
437 struct device *device) 435 struct device *device)
438{ 436{
439 int retval; 437 int retval;
440 struct firmware_priv *fw_priv = kzalloc(sizeof(*fw_priv), 438 struct firmware_priv *fw_priv =
441 GFP_KERNEL); 439 kzalloc(sizeof(*fw_priv) + strlen(fw_name) + 1 , GFP_KERNEL);
442 struct device *f_dev = kzalloc(sizeof(*f_dev), GFP_KERNEL); 440 struct device *f_dev = kzalloc(sizeof(*f_dev), GFP_KERNEL);
443 441
444 *dev_p = NULL; 442 *dev_p = NULL;
@@ -449,16 +447,9 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
449 goto error_kfree; 447 goto error_kfree;
450 } 448 }
451 449
450 strcpy(fw_priv->fw_id, fw_name);
452 init_completion(&fw_priv->completion); 451 init_completion(&fw_priv->completion);
453 fw_priv->attr_data = firmware_attr_data_tmpl; 452 fw_priv->attr_data = firmware_attr_data_tmpl;
454 fw_priv->fw_id = kstrdup(fw_name, GFP_KERNEL);
455 if (!fw_priv->fw_id) {
456 dev_err(device, "%s: Firmware name allocation failed\n",
457 __func__);
458 retval = -ENOMEM;
459 goto error_kfree;
460 }
461
462 fw_priv->timeout.function = firmware_class_timeout; 453 fw_priv->timeout.function = firmware_class_timeout;
463 fw_priv->timeout.data = (u_long) fw_priv; 454 fw_priv->timeout.data = (u_long) fw_priv;
464 init_timer(&fw_priv->timeout); 455 init_timer(&fw_priv->timeout);