* [PATCH] mfd: sm501: Add check for platform_driver_register
@ 2022-09-13 9:11 Jiasheng Jiang
2022-09-28 9:43 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2022-09-13 9:11 UTC (permalink / raw)
To: lee; +Cc: linux-kernel, Jiasheng Jiang
As platform_driver_register() can return error numbers,
it should be better to check platform_driver_register()
and deal with the exception.
Fixes: b6d6454fdb66 ("[PATCH] mfd: SM501 core driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
drivers/mfd/sm501.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index bc0a2c38653e..3ac4508a6742 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1720,7 +1720,12 @@ static struct platform_driver sm501_plat_driver = {
static int __init sm501_base_init(void)
{
- platform_driver_register(&sm501_plat_driver);
+ int ret;
+
+ ret = platform_driver_register(&sm501_plat_driver);
+ if (ret < 0)
+ return ret;
+
return pci_register_driver(&sm501_pci_driver);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: sm501: Add check for platform_driver_register
2022-09-13 9:11 [PATCH] mfd: sm501: Add check for platform_driver_register Jiasheng Jiang
@ 2022-09-28 9:43 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2022-09-28 9:43 UTC (permalink / raw)
To: Jiasheng Jiang; +Cc: linux-kernel
On Tue, 13 Sep 2022, Jiasheng Jiang wrote:
> As platform_driver_register() can return error numbers,
> it should be better to check platform_driver_register()
> and deal with the exception.
>
> Fixes: b6d6454fdb66 ("[PATCH] mfd: SM501 core driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> drivers/mfd/sm501.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Applied, thanks.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-28 9:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 9:11 [PATCH] mfd: sm501: Add check for platform_driver_register Jiasheng Jiang
2022-09-28 9:43 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).