mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 10:17:32 +00:00
firmware: google: Unregister driver_info on failure
When platform_device_register_full() returns error, the gsmi_init() returns without unregister gsmi_driver_info, fix by add missing platform_driver_unregister() when platform_device_register_full() failed. Fixes: 8942b2d5094b ("gsmi: Add GSMI commands to log S0ix info") Signed-off-by: Yuan Can <yuancan@huawei.com> Acked-by: Brian Norris <briannorris@chromium.org> Link: https://lore.kernel.org/r/20241015131344.20272-1-yuancan@huawei.com Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
This commit is contained in:
parent
67f488dff1
commit
32b0901e14
@ -918,7 +918,8 @@ static __init int gsmi_init(void)
|
||||
gsmi_dev.pdev = platform_device_register_full(&gsmi_dev_info);
|
||||
if (IS_ERR(gsmi_dev.pdev)) {
|
||||
printk(KERN_ERR "gsmi: unable to register platform device\n");
|
||||
return PTR_ERR(gsmi_dev.pdev);
|
||||
ret = PTR_ERR(gsmi_dev.pdev);
|
||||
goto out_unregister;
|
||||
}
|
||||
|
||||
/* SMI access needs to be serialized */
|
||||
@ -1056,10 +1057,11 @@ out_err:
|
||||
gsmi_buf_free(gsmi_dev.name_buf);
|
||||
kmem_cache_destroy(gsmi_dev.mem_pool);
|
||||
platform_device_unregister(gsmi_dev.pdev);
|
||||
pr_info("gsmi: failed to load: %d\n", ret);
|
||||
out_unregister:
|
||||
#ifdef CONFIG_PM
|
||||
platform_driver_unregister(&gsmi_driver_info);
|
||||
#endif
|
||||
pr_info("gsmi: failed to load: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user