From patchwork Sat Sep 7 06:54:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: He Lugang X-Patchwork-Id: 13795104 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19BD5E6FE4D for ; Sat, 7 Sep 2024 06:55:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE5CE10E729; Sat, 7 Sep 2024 06:55:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=uniontech.com header.i=@uniontech.com header.b="XrUwsnXG"; dkim-atps=neutral X-Greylist: delayed 69899 seconds by postgrey-1.36 at gabe; Sat, 07 Sep 2024 06:55:33 UTC Received: from bg1.exmail.qq.com (bg1.exmail.qq.com [114.132.58.223]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9AFF10E729 for ; Sat, 7 Sep 2024 06:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1725692093; bh=yfvC59lnVqCax5p/e7Q8hKA5Ouv+EjV+B2EInFi8R5A=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=XrUwsnXGJPi/VdPKKGiEaiJ0yoJ/sP0fZgk3AtiMqcsQumQjeiYXK68avYaivYlYe RjolHArHHmNO+yQjid/c/xc778TMXCyaQ3K3JCrzG6stNm7TvUykbdZ2gndo5zxYXa sFAg+ulTDgQGfjZOatoDLqsNGrtW/YG/rkivWxYo= X-QQ-mid: bizesmtpsz9t1725692090tbhj9u3 X-QQ-Originating-IP: 0YhjS5yZ+OmtEIBzYtwSZmyZaKAh8IOW6App3/aY05c= Received: from localhost.localdomain ( [221.226.144.218]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 07 Sep 2024 14:54:43 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 17723308322550964968 From: He Lugang To: lucas.demarchi@intel.com, thomas.hellstrom@linux.intel.com, rodrigo.vivi@intel.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, He Lugang Subject: [PATCH 1/3] drm/xe: use devm_add_action_or_reset() helper Date: Sat, 7 Sep 2024 14:54:39 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtpsz:uniontech.com:qybglogicsvrgz:qybglogicsvrgz7a-0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- drivers/gpu/drm/xe/xe_gt_freq.c | 2 +- drivers/gpu/drm/xe/xe_gt_sysfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_gt_freq.c b/drivers/gpu/drm/xe/xe_gt_freq.c index 68a5778b4319..71bcd60d0866 100644 --- a/drivers/gpu/drm/xe/xe_gt_freq.c +++ b/drivers/gpu/drm/xe/xe_gt_freq.c @@ -237,7 +237,7 @@ int xe_gt_freq_init(struct xe_gt *gt) if (!gt->freq) return -ENOMEM; - err = devm_add_action(xe->drm.dev, freq_fini, gt->freq); + err = devm_add_action_or_reset(xe->drm.dev, freq_fini, gt->freq); if (err) return err; diff --git a/drivers/gpu/drm/xe/xe_gt_sysfs.c b/drivers/gpu/drm/xe/xe_gt_sysfs.c index a05c3699e8b9..ec2b8246204b 100644 --- a/drivers/gpu/drm/xe/xe_gt_sysfs.c +++ b/drivers/gpu/drm/xe/xe_gt_sysfs.c @@ -51,5 +51,5 @@ int xe_gt_sysfs_init(struct xe_gt *gt) gt->sysfs = &kg->base; - return devm_add_action(xe->drm.dev, gt_sysfs_fini, gt); + return devm_add_action_or_reset(xe->drm.dev, gt_sysfs_fini, gt); } From patchwork Sat Sep 7 07:00:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: He Lugang X-Patchwork-Id: 13795106 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 839F6E6FE4F for ; Sat, 7 Sep 2024 07:01:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DA8E910E817; Sat, 7 Sep 2024 07:01:10 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=uniontech.com header.i=@uniontech.com header.b="baigTiG0"; dkim-atps=neutral X-Greylist: delayed 89631 seconds by postgrey-1.36 at gabe; Sat, 07 Sep 2024 07:01:08 UTC Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5462B10E817 for ; Sat, 7 Sep 2024 07:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1725692420; bh=Zlnter0CIEiqLPIY1ZRE/Q76uzwHmueWTv3hL1cG8Ys=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=baigTiG0FgVHKeN+5lRD1uRLViePBRTkkwFGWN9u0e7ZNbwt6j6uubHELEoKeOKrg rkqkCmm+mPqB0Wr40M2G++/AtCHWrTxT7wnJXKtHZD9zWmNNmB9lrWzpKVxeRrAs4l rfYwfoXpxF+dCHN8Vw6LhMYVMuWdLM40JpnDz6q8= X-QQ-mid: bizesmtp79t1725692417t9pbm363 X-QQ-Originating-IP: RQQ3ZYuKn4lfMA+MstH4V8ZD/hhuIFWX5OniXe0luCY= Received: from localhost.localdomain ( [221.226.144.218]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 07 Sep 2024 15:00:12 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 14737816979990664650 From: He Lugang To: noralf@tronnes.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch Cc: dri-devel@lists.freedesktop.org, He Lugang Subject: [PATCH 2/3] drm/gud: use devm_add_action_or_reset() helper Date: Sat, 7 Sep 2024 15:00:10 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybglogicsvrgz:qybglogicsvrgz7a-0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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; From patchwork Sat Sep 7 07:13:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: He Lugang X-Patchwork-Id: 13795107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F982E6FE4F for ; Sat, 7 Sep 2024 07:14:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D01810E1D2; Sat, 7 Sep 2024 07:14:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=uniontech.com header.i=@uniontech.com header.b="GFeOfRaV"; dkim-atps=neutral X-Greylist: delayed 90328 seconds by postgrey-1.36 at gabe; Sat, 07 Sep 2024 07:14:00 UTC Received: from bg1.exmail.qq.com (bg1.exmail.qq.com [114.132.64.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1421E10E1D2 for ; Sat, 7 Sep 2024 07:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1725693200; bh=7wmBvLIf+7VxxIKLN2n6bgLn+1DR5ZfTO8tJ4CJQlek=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=GFeOfRaVYsPr2i8WD9Y3JZG67paygGonfodvPlOWoJpyjzYf8MO4qPjesPI+DDdTN rYpgBtQ/dcPoG2NBonCVty9ofFAHejHOn67y7uoFDOttKK3B3xJCwOI9Xs2hCW/UuM gPPPgz4LJAvAj/vdvIkqBG7SsKKZpgKa6wIqmR9k= X-QQ-mid: bizesmtpsz10t1725693194tzjajl X-QQ-Originating-IP: i8sSZCS+iou7eafb46pHc6Yylys551YFfi7GwCQvpxs= Received: from localhost.localdomain ( [221.226.144.218]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 07 Sep 2024 15:13:06 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 15511716791803928476 From: He Lugang To: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch Cc: dri-devel@lists.freedesktop.org, He Lugang Subject: [PATCH 3/3] drm/i2c/tda9950: use devm_add_action_or_reset() helper Date: Sat, 7 Sep 2024 15:13:05 +0800 Message-ID: X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtpsz:uniontech.com:qybglogicsvrgz:qybglogicsvrgz7a-0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/i2c/tda9950.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda9950.c b/drivers/gpu/drm/i2c/tda9950.c index 82d618c40dce..e9dae19d7acd 100644 --- a/drivers/gpu/drm/i2c/tda9950.c +++ b/drivers/gpu/drm/i2c/tda9950.c @@ -361,11 +361,7 @@ static int tda9950_devm_glue_init(struct device *dev, struct tda9950_glue *glue) return ret; } - ret = devm_add_action(dev, tda9950_devm_glue_exit, glue); - if (ret) - tda9950_devm_glue_exit(glue); - - return ret; + return devm_add_action_or_reset(dev, tda9950_devm_glue_exit, glue); } static void tda9950_cec_del(void *data) @@ -425,11 +421,9 @@ static int tda9950_probe(struct i2c_client *client) if (IS_ERR(priv->adap)) return PTR_ERR(priv->adap); - ret = devm_add_action(dev, tda9950_cec_del, priv); - if (ret) { - cec_delete_adapter(priv->adap); + ret = devm_add_action_or_reset(dev, tda9950_cec_del, priv); + if (ret) return ret; - } ret = tda9950_devm_glue_init(dev, glue); if (ret)