aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/firmware_class.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 8a267c427629..2d296b7f7034 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -356,7 +356,7 @@ static void fw_dev_release(struct device *dev)
356 __free_page(fw_priv->pages[i]); 356 __free_page(fw_priv->pages[i]);
357 kfree(fw_priv->pages); 357 kfree(fw_priv->pages);
358 kfree(fw_priv); 358 kfree(fw_priv);
359 kfree(dev); 359 put_device(dev);
360 360
361 module_put(THIS_MODULE); 361 module_put(THIS_MODULE);
362} 362}
@@ -400,14 +400,16 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
400 retval = device_register(f_dev); 400 retval = device_register(f_dev);
401 if (retval) { 401 if (retval) {
402 dev_err(device, "%s: device_register failed\n", __func__); 402 dev_err(device, "%s: device_register failed\n", __func__);
403 goto error_kfree; 403 put_device(f_dev);
404 goto error_kfree1;
404 } 405 }
405 *dev_p = f_dev; 406 *dev_p = f_dev;
406 return 0; 407 return 0;
407 408
408error_kfree: 409error_kfree:
409 kfree(fw_priv);
410 kfree(f_dev); 410 kfree(f_dev);
411error_kfree1:
412 kfree(fw_priv);
411 return retval; 413 return retval;
412} 414}
413 415