mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
firmware: meson_sm: fix device leak at probe
Make sure to drop the reference to the secure monitor device taken by
of_find_device_by_node() when looking up its driver data on behalf of
other drivers (e.g. during probe).
Note that holding a reference to the platform device does not prevent
its driver data from going away so there is no point in keeping the
reference after the helper returns.
Fixes: 8cde3c2153 ("firmware: meson_sm: Rework driver as a proper platform driver")
Cc: stable@vger.kernel.org # 5.5
Cc: Carlo Caione <ccaione@baylibre.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20250725074019.8765-1-johan@kernel.org
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
This commit is contained in:
committed by
Neil Armstrong
parent
8f5ae30d69
commit
8ece3173f8
@@ -232,11 +232,16 @@ EXPORT_SYMBOL(meson_sm_call_write);
|
|||||||
struct meson_sm_firmware *meson_sm_get(struct device_node *sm_node)
|
struct meson_sm_firmware *meson_sm_get(struct device_node *sm_node)
|
||||||
{
|
{
|
||||||
struct platform_device *pdev = of_find_device_by_node(sm_node);
|
struct platform_device *pdev = of_find_device_by_node(sm_node);
|
||||||
|
struct meson_sm_firmware *fw;
|
||||||
|
|
||||||
if (!pdev)
|
if (!pdev)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return platform_get_drvdata(pdev);
|
fw = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
put_device(&pdev->dev);
|
||||||
|
|
||||||
|
return fw;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(meson_sm_get);
|
EXPORT_SYMBOL_GPL(meson_sm_get);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user