aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/firmware_class.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/firmware_class.c')
-rw-r--r--drivers/base/firmware_class.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index ddeb819c8f87..7376367bcb80 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -180,7 +180,6 @@ static ssize_t firmware_loading_store(struct device *dev,
180 goto err; 180 goto err;
181 } 181 }
182 /* Pages will be freed by vfree() */ 182 /* Pages will be freed by vfree() */
183 fw_priv->pages = NULL;
184 fw_priv->page_array_size = 0; 183 fw_priv->page_array_size = 0;
185 fw_priv->nr_pages = 0; 184 fw_priv->nr_pages = 0;
186 complete(&fw_priv->completion); 185 complete(&fw_priv->completion);
@@ -217,8 +216,10 @@ firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr,
217 ret_count = -ENODEV; 216 ret_count = -ENODEV;
218 goto out; 217 goto out;
219 } 218 }
220 if (offset > fw->size) 219 if (offset > fw->size) {
221 return 0; 220 ret_count = 0;
221 goto out;
222 }
222 if (count > fw->size - offset) 223 if (count > fw->size - offset)
223 count = fw->size - offset; 224 count = fw->size - offset;
224 225
@@ -357,7 +358,7 @@ static void fw_dev_release(struct device *dev)
357 kfree(fw_priv->pages); 358 kfree(fw_priv->pages);
358 kfree(fw_priv->fw_id); 359 kfree(fw_priv->fw_id);
359 kfree(fw_priv); 360 kfree(fw_priv);
360 put_device(dev); 361 kfree(dev);
361 362
362 module_put(THIS_MODULE); 363 module_put(THIS_MODULE);
363} 364}
@@ -408,13 +409,11 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
408 if (retval) { 409 if (retval) {
409 dev_err(device, "%s: device_register failed\n", __func__); 410 dev_err(device, "%s: device_register failed\n", __func__);
410 put_device(f_dev); 411 put_device(f_dev);
411 goto error_kfree_fw_id; 412 return retval;
412 } 413 }
413 *dev_p = f_dev; 414 *dev_p = f_dev;
414 return 0; 415 return 0;
415 416
416error_kfree_fw_id:
417 kfree(fw_priv->fw_id);
418error_kfree: 417error_kfree:
419 kfree(f_dev); 418 kfree(f_dev);
420 kfree(fw_priv); 419 kfree(fw_priv);