Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6851920ybi; Mon, 8 Jul 2019 09:37:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQakzKH0BtPWNykQaQOk8/dg41cJ6fKmPzshvaigVZURoUaJp9TksCpjESWH9Lo6868DsC X-Received: by 2002:a17:90a:bb94:: with SMTP id v20mr27343493pjr.88.1562603870025; Mon, 08 Jul 2019 09:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562603870; cv=none; d=google.com; s=arc-20160816; b=bErMcsipKwlpmeqmk7ig5/3t9QuxTgKzUCQetHQcTKZJeWvh/VabhYZRDD8Dhr1Ky5 u7GPrIFvxfktfmc+8pxHEEBUNW43AfF5Artwokj8HueSnXP/yIwf4ErMH4Qw5uPHRDp+ GLYunHFRRD0BPN5kgGBVGwWm/TuZK2o+j0NrUtzPM5vCTZ7T6DeYNJxPADQhU3NuZf1d Uz1dOGyBdfn4LPSWi9Ars51c+3Vsks4PV5AeWgowalTUMd96xRGm2PC+uwrVqtrzk1ly oxERwa0IQ/zgC5UmM9Zhm390J6jn6JY6acPooJuzoqZkAM+fm/f8Xqi5bg10mhpmWsAF QPvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature; bh=cnpaUYY7PfsaPEiNSsa/HFMftAhnh6cWuyIN2oyHtQI=; b=c0oQDyR5NWquDvC2kSh7o8kGYspjWtXKXEqgulUITcJqJhUo3ms4hui+5bO53lTrMV LNDPHIw22XkyFMlmALWVY4T658XQPhond88w5/356jnfduPdao86iNi0NaHHzAC2Jrz9 2EiT1MSOKVM5duEztcUdUn5nHQFp8J1eg6MqsDPib3T+XWhhtff2uUAd0wM9XN6zTFXK 9zT4JNNRNo6SyXEuKwiULtfkfe6U3czCUCUHjohxdjO6WiXudgiVdM6cynb8yIMYQU/e qf3QKJmkwcJYizgQZemTngYWzi80W0gPA0Bokv8Un7HYN/HoWZROqHn4fIEXzUo3G/sw 9AlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=oq23msEj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91si19151237plc.54.2019.07.08.09.37.34; Mon, 08 Jul 2019 09:37:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=oq23msEj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730710AbfGHMdX (ORCPT + 99 others); Mon, 8 Jul 2019 08:33:23 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41990 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbfGHMdX (ORCPT ); Mon, 8 Jul 2019 08:33:23 -0400 Received: by mail-pl1-f193.google.com with SMTP id ay6so8202056plb.9 for ; Mon, 08 Jul 2019 05:33:22 -0700 (PDT) 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-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=U9BeUQXdRE9Gz8cFFl4+PcCcjqTze62DusVqnwG9CaIW64Kyj+BVPGIvelkXZLMT0N J1v8ZP2mpAHz9GDp9fmSSXsX+bTR5lO2qtCUfHbOh1CfcxDcM6NLepE2GAiUznebJhjo 2yy3gwOkD+L9rXy+ydDUBxVw17IbqbpAymxXRP7dwfzoyUW4ZFW1vFo9oy+Ka/LYP8ma yAYzjgm+9ziEzJBodc40ZlcCEXIb1mfMx/j+uJbh/048Mn6tQ2x5XqajHmSjW5Pp3Bza 450LhZ/2zxUIi4MnDZAs+awg38g0JNZMcBdfGdU2MJpPZ9R5VW8bae4wL5aDy57XFuJw NupA== X-Gm-Message-State: APjAAAXnwh4Y7p3bWqYLzV0ghZcD9pIJ63NSiP9jMx/3jiGNoUplkWm4 t1tca6ampzfGcEgA0IawJeE= 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 Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Fuqian Huang 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 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.11.0