Use devm_add_action_or_reset() to release resources in case of failure, because the cleanup function will be automatically called. Signed-off-by: He Lugang <helugang@xxxxxxxxxxxxx> --- drivers/gpu/drm/gud/gud_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c index ac6bbf920c72..f121f6deb268 100644 --- a/drivers/gpu/drm/gud/gud_drv.c +++ b/drivers/gpu/drm/gud/gud_drv.c @@ -473,7 +473,7 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id) INIT_WORK(&gdrm->work, gud_flush_work); gud_clear_damage(gdrm); - ret = devm_add_action(dev, gud_free_buffers_and_mutex, gdrm); + ret = devm_add_action_or_reset(dev, gud_free_buffers_and_mutex, gdrm); if (ret) return ret; -- 2.45.2