From patchwork Mon Jul 8 12:33:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuqian Huang X-Patchwork-Id: 11036415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 246A41395 for ; Tue, 9 Jul 2019 07:03:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 152B926E1A for ; Tue, 9 Jul 2019 07:03:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09ED6286A2; Tue, 9 Jul 2019 07:03:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_WEB autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8982286A7 for ; Tue, 9 Jul 2019 07:03:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A9AA89971; Tue, 9 Jul 2019 07:02:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04A9A89D4D for ; Mon, 8 Jul 2019 12:33:23 +0000 (UTC) Received: by mail-pl1-x641.google.com with SMTP id c14so8202452plo.0 for ; Mon, 08 Jul 2019 05:33:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cnpaUYY7PfsaPEiNSsa/HFMftAhnh6cWuyIN2oyHtQI=; b=RpIM+t0vrY9c0iZF9J/OQiPxyebbc1k8rwJmBMIHMkQrMqxbdx9Zeu/aQIT/0L/1GM ce2HE5mrr24dyY7XQjZdewAldcryJVIYBuHJR39CiJZgZphzjfe+IIK6pvePKLnCFHi/ QaLG1N+x1kSoi1V2pw9XpUiz45r3Dysy70zlOPB3h8cuMq9fzJZUlJ+23394oT39Bthf 4fxFtQLj1caSXUNrgzX3M2dwguGRlHPJ4Mybg4HahUEnBVui1dCW6FB4/Igqai4ihHS8 SDMs0v68hIScuj3OoQvlF+hBB2LzUTlBzCSsBEMd1ZH4kM9gJeU3cIfYrO/zk8QT8uod YV+A== X-Gm-Message-State: APjAAAUbaU9zyw0ng4dATZL+DQ2S1zlsCLo7jFBjneFcQhbmIPY1b30g KaBo/GKFdUsGIrzEc/FvDA4= X-Google-Smtp-Source: APXvYqw5PgsxhbaI8eUmPiNT21zGE7yXFZ6cMZ56ySR8GcW2gXlNXBV2MFZVeGhPWAum1yV27k5+pA== X-Received: by 2002:a17:902:6b02:: with SMTP id o2mr22656033plk.99.1562589202713; Mon, 08 Jul 2019 05:33:22 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id j24sm23386297pgg.86.2019.07.08.05.33.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jul 2019 05:33:22 -0700 (PDT) From: Fuqian Huang To: Subject: [PATCH 06/14] drm/i2c: tda9950: Replace devm_add_action() followed by failure action with devm_add_action_or_reset() Date: Mon, 8 Jul 2019 20:33:15 +0800 Message-Id: <20190708123315.11897-1-huangfq.daxian@gmail.com> X-Mailer: git-send-email 2.11.0 X-Mailman-Approved-At: Tue, 09 Jul 2019 07:01:45 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=cnpaUYY7PfsaPEiNSsa/HFMftAhnh6cWuyIN2oyHtQI=; b=oq23msEjxcp/YyvSg1o4afYr5Q8Sb2xtGTbtsbrLoZz1W5PzO5QhZmHvBqXz/kE0hJ dk6DJM0VLA3Kdr+aMUDHu3MU3d5cn8/1InYpj6Nseky2nJGFt7LX+ds0YBE+mI27/qiQ DT7bde2LtthGa0IgVWpWisyzpcHir8bFypHN+w4GfpfFhssCWKTTytBQubgvCEP0lMyi lbU/71Lm3LCCLvllIgEN+ifjZe5cNAjVczwL6Engpe+0K/f3wnuPumPGCKKANQYhI6V6 MCoWFOSWje6xxISlSgoCAKTQOrsc1kmos6qF7wFtNWBLUQNR5kx3b7XxfmM6FjxstBtc FTcA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Fuqian Huang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP devm_add_action_or_reset() is introduced as a helper function which internally calls devm_add_action(). If devm_add_action() fails then it will execute the action mentioned and return the error code. This reduce source code size (avoid writing the action twice) and reduce the likelyhood of bugs. Signed-off-by: Fuqian Huang --- drivers/gpu/drm/i2c/tda9950.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda9950.c b/drivers/gpu/drm/i2c/tda9950.c index 8039fc0d83db..042f6487e6fb 100644 --- a/drivers/gpu/drm/i2c/tda9950.c +++ b/drivers/gpu/drm/i2c/tda9950.c @@ -361,9 +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); + ret = devm_add_action_or_reset(dev, tda9950_devm_glue_exit, glue); return ret; }