On Fri, Sep 26, 2025 at 4:25 PM Johan Hovold johan@kernel.org wrote:
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 28f851e6afa8 ("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: d4983983d987 ("soc: amlogic: add meson-canvas driver") Cc: stable@vger.kernel.org # 4.20: 28f851e6afa8 Cc: Yu Kuai yukuai3@huawei.com Signed-off-by: Johan Hovold johan@kernel.org
Reviewed-by: Martin Blumenstingl martin.blumenstingl@googlemail.com
I haven't used the scope-based resource management myself as pointed out by Markus. That said, as far as I understand it's a feature in newer kernels and this patch may be backported until 5.4 (oldest -stable kernel still supported). So let's go with this simple approach from Johan - we can still improve this (without having to worry about backports).
Best regards, Martin