media: marvell: manage the MMP camera clock provider
Subsystems (2)
PATCH 1/1 media: marvell: manage the MMP camera clock provider
mmpcam_probe() registers an OF clock provider before requesting the IRQ. Neither a later probe failure nor driver removal unregisters that provider, although the underlying clock is registered with devm_clk_register(). This leaves the provider referring to a clock whose lifetime has ended.
Use devm_of_clk_add_hw_provider() with the existing mclk_hw so the provider is unregistered before the managed clock and camera storage are released.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
Fixes 81a409bfd551 ("media: marvell-ccic: provide a clock for the sensor")
Assisted-by OpenAI:GPT-5.6
Co-developed-by Ijae Kim <[email protected]>
Signed-off-by Ijae Kim <[email protected]>
Signed-off-by Myeonghun Pak <[email protected]>
--- drivers/media/platform/marvell/mmp-driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/platform/marvell/mmp-driver.c +3 -2
@@ -25,6 +25,7 @@#include <linux/list.h> #include <linux/pm.h> #include <linux/clk.h> +#include <linux/clk-provider.h> #include "mcam-core.h"
@@ -269,8 +270,8 @@ static int mmpcam_probe(struct platform_device *pdev)/* * Add OF clock provider. */ - ret =of_clk_add_provider (pdev->dev.of_node, of_clk_src_simple_get, - mcam->mclk); + ret =devm_of_clk_add_hw_provider (&pdev->dev, of_clk_hw_simple_get, + &mcam->mclk_hw);if (ret) {dev_err (&pdev->dev,"can't add DT clock provider\n" ); goto out;
Signature · 1 line
2.53.0