On Tue, Sep 20, 2022 at 09:48:16PM +0800, Yang Yingliang wrote: > @@ -476,7 +474,6 @@ static int uwire_probe(struct platform_device *pdev) > if (IS_ERR(uwire->ck)) { > status = PTR_ERR(uwire->ck); > dev_dbg(&pdev->dev, "no functional clock?\n"); > - spi_master_put(master); > return status; > } > clk_prepare_enable(uwire->ck); Change this hunk to return PTR_ERR(uwire->ck) directly without assigning to status first. > @@ -518,6 +515,7 @@ static int uwire_remove(struct platform_device *pdev) > > spi_bitbang_stop(&uwire->bitbang); > uwire_off(uwire); > + spi_master_put(uwire->bitbang.master); > return 0; > } > No, drop this hunk, it results in a use-after-free. Thanks, Lukas