Skip to content

Commit 81bf278

Browse files
jhovoldgregkh
authored andcommitted
soc: amlogic: canvas: fix device leak on lookup
commit 32200f4 upstream. Make sure to drop the reference taken to the canvas platform device when looking up its driver data. Note that holding a reference to a device does not prevent its driver data from going away so there is no point in keeping the reference. Also note that commit 28f851e ("soc: amlogic: canvas: add missing put_device() call in meson_canvas_get()") fixed the leak in a lookup error path, but the reference is still leaking on success. Fixes: d498398 ("soc: amlogic: add meson-canvas driver") Cc: stable@vger.kernel.org # 4.20: 28f851e Cc: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://patch.msgid.link/20250926142454.5929-2-johan@kernel.org Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 25073a0 commit 81bf278

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/soc/amlogic/meson-canvas.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,9 @@ struct meson_canvas *meson_canvas_get(struct device *dev)
7373
* current state, this driver probe cannot return -EPROBE_DEFER
7474
*/
7575
canvas = dev_get_drvdata(&canvas_pdev->dev);
76-
if (!canvas) {
77-
put_device(&canvas_pdev->dev);
76+
put_device(&canvas_pdev->dev);
77+
if (!canvas)
7878
return ERR_PTR(-EINVAL);
79-
}
8079

8180
return canvas;
8281
}

0 commit comments

Comments
 (0)