Skip to content

Commit

Permalink
HSI: omap_ssi_core: fix possible memory leak in ssi_probe()
Browse files Browse the repository at this point in the history
[ Upstream commit 1aff514 ]

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: b209e04 ("HSI: Introduce OMAP SSI driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Dec 31, 2022
1 parent 8159e2f commit fa80f14
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/hsi/controllers/omap_ssi_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fa80f14

Please sign in to comment.