* [PATCH] HSI: omap_ssi_core: fix possible memory leak in ssi_probe()
@ 2022-10-31 7:43 Yang Yingliang
2022-11-14 20:51 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-10-31 7:43 UTC (permalink / raw)
To: linux-kernel; +Cc: sre, carlos.chinea, ivo.g.dimitrov.75
If ssi_add_controller() returns error, it should call hsi_put_controller()
to give up the reference that was set in hsi_alloc_controller(), so that
it can call hsi_controller_release() to free controller and ports that
allocated in hsi_alloc_controller().
Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/hsi/controllers/omap_ssi_core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
index eb9820158318..80bf09bc5d15 100644
--- a/drivers/hsi/controllers/omap_ssi_core.c
+++ b/drivers/hsi/controllers/omap_ssi_core.c
@@ -502,8 +502,10 @@ static int ssi_probe(struct platform_device *pd)
platform_set_drvdata(pd, ssi);
err = ssi_add_controller(ssi, pd);
- if (err < 0)
+ if (err < 0) {
+ hsi_put_controller(ssi);
goto out1;
+ }
pm_runtime_enable(&pd->dev);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] HSI: omap_ssi_core: fix possible memory leak in ssi_probe()
2022-10-31 7:43 [PATCH] HSI: omap_ssi_core: fix possible memory leak in ssi_probe() Yang Yingliang
@ 2022-11-14 20:51 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2022-11-14 20:51 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, carlos.chinea, ivo.g.dimitrov.75
[-- Attachment #1: Type: text/plain, Size: 1165 bytes --]
Hi,
On Mon, Oct 31, 2022 at 03:43:37PM +0800, Yang Yingliang wrote:
> If ssi_add_controller() returns error, it should call hsi_put_controller()
> to give up the reference that was set in hsi_alloc_controller(), so that
> it can call hsi_controller_release() to free controller and ports that
> allocated in hsi_alloc_controller().
>
> Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
Thanks, queued.
-- Sebastian
> drivers/hsi/controllers/omap_ssi_core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c
> index eb9820158318..80bf09bc5d15 100644
> --- a/drivers/hsi/controllers/omap_ssi_core.c
> +++ b/drivers/hsi/controllers/omap_ssi_core.c
> @@ -502,8 +502,10 @@ static int ssi_probe(struct platform_device *pd)
> platform_set_drvdata(pd, ssi);
>
> err = ssi_add_controller(ssi, pd);
> - if (err < 0)
> + if (err < 0) {
> + hsi_put_controller(ssi);
> goto out1;
> + }
>
> pm_runtime_enable(&pd->dev);
>
> --
> 2.25.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-14 20:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-31 7:43 [PATCH] HSI: omap_ssi_core: fix possible memory leak in ssi_probe() Yang Yingliang
2022-11-14 20:51 ` Sebastian Reichel
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).