Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6767946ybi; Mon, 8 Jul 2019 08:20:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyMVuh+UQVwLwQ9E3J4wV0HiEhMByTVr+RZ1EeYhIUop9agxHCQVE6bPDVOD5az/aQ7jcMy X-Received: by 2002:a17:90a:ab0d:: with SMTP id m13mr25379368pjq.84.1562599233472; Mon, 08 Jul 2019 08:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562599233; cv=none; d=google.com; s=arc-20160816; b=LQc230ngBXGVrAL2MTTtLarz/opYcIqzXfPTqzFNfi4tw1hfF2J+wb6A3gEcG8Vn1B Nbhlg9LVHHKBCuGjsPyETnbwdldam0MOzvJ82DjN8hgzQU2jHS2t3CBygZRZlEq9mxQs lVUot6Zy/6ZogfxJpZsrTp/PyaMFAcLQjwUPRxllcw+MpVWfxmu7QtvgXNXUeJbyKg+x TgDIzJUXokC0MysTTAK7eVNI6JmMoGXxkqEpjDspbZ/hy9AiTEYjWlEwhEAFzhW9uH/Z oEwFREqwc2+sdAjxsHeoJFDadffTgLDFcgsxmAua1wRshV9Xjw/gFCei3HutOL3vnr+p ui/Q== 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=NjnqLo3iz545x+S/KElhJPXTzOJzfZJMgeETAvhK2LU=; b=UXt7lPyaAe8J6+y7lpfEuLmYiVT9KBw5rLgZ4Z6hu/8K+rmd6ZXuhefAhGRMiO6Trd K72ouBvpArLTCqH3L6r+iQA9DLX6npc0+Loy6dnsTxmA+6j8Toe8FWr8lHDkR0OK+6xg iSIr2pzaEQUidSFPSlFSh3mobMS1gqclbRCbvgs8UpZevdE21MYkT+bWaDBlX4qC3YaV VwZMk02jWgcupF4Xj6WhHmAowCmoyk2yd62rsyu0XuMRN5ofZ2Dz0Jf+IQDcK0CgLvbb 4tEF62gx+LfTq7iqXGgpiCVna+i1a8oBeCnwxCmGQO0j5fhUSnk+HYqH2T8U5X6sMJhJ 1/Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ZOSKOH9p; 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 v12si21357422pgq.423.2019.07.08.08.20.17; Mon, 08 Jul 2019 08:20:33 -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=ZOSKOH9p; 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 S1730793AbfGHMeR (ORCPT + 99 others); Mon, 8 Jul 2019 08:34:17 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36979 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727544AbfGHMeQ (ORCPT ); Mon, 8 Jul 2019 08:34:16 -0400 Received: by mail-pg1-f196.google.com with SMTP id g15so7624730pgi.4; Mon, 08 Jul 2019 05:34:16 -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=NjnqLo3iz545x+S/KElhJPXTzOJzfZJMgeETAvhK2LU=; b=ZOSKOH9ptz42APtzNxr/4fxHNtLoWbGY1peNF/bZjQqe6lKg5MN560m0wpvTf/9EJx B+TG/tCXqG7H4/QoHftgxuWTZshzZVclaaR6T+yfQeRx4F6ZIR30GzHeEBrclcl53PJX bKwEwHg/H6JrvHZ2gu3Sb8zxI8wyuorntaxWeQ42Q2vAYIRSTt+f38PoKJTz5bNJ4Fx5 B2/Yze+0Q3nVnZxnS2ewedrjHHpn68RPTWghoQFznhqkA6GlZEQCIyYha0Xj0HdpNfQz rS6dIDFHNCVWU7gNeg9xu9GauI/5bXhQ4nef7sfUVTEvgeozM07QBiauuKiDmtDj6Uot WHAQ== 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=NjnqLo3iz545x+S/KElhJPXTzOJzfZJMgeETAvhK2LU=; b=XqwD8Q89fSwlVEcQVYeC9SQHWQ7AAC1ltZR3Hz+v5wV/2QNjx3njTgrAX7Cw+YI8+q rkxGKKysDNFYNyMGM9BlO0d7T+HeczFEWKX5yUd1aTfYTyI6qdcL1M3ZeyIHQKUsl9GX fDp7V5kmMwx8JtZh0TbqFK5JU0R/fF/gSx2HAFw06B8BW3xdxoUVtxkD7UiUvYjRB7eB 5eNRszlldEaZs9B5+esTuTEQG5eHuf4PRZe2rNQ/3aiY2/MuGR46VCQAarXYmtXjenbz c/Em1ehsHvYTrL4WOa9x5665GQJ1W5OsS7hbEMXF79SlaTcnpmibhjq8o8PD9VtjcI4M 2lqg== X-Gm-Message-State: APjAAAWBUaX1uItqvSly8KAepvFzBWOliufq9IoPFjHypTvepX57Kqiq zgfvaCUGSsRtvUpL5wcsMgGUK9mZgL4= X-Received: by 2002:a63:6f8f:: with SMTP id k137mr23414666pgc.90.1562589255980; Mon, 08 Jul 2019 05:34:15 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id br18sm14785970pjb.20.2019.07.08.05.34.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jul 2019 05:34:15 -0700 (PDT) From: Fuqian Huang Cc: Zhang Rui , Eduardo Valentin , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Fuqian Huang Subject: [PATCH 13/14] thermal: rcar_gen3_thermal: Replace devm_add_action() followed by failure action with devm_add_action_or_reset() Date: Mon, 8 Jul 2019 20:34:09 +0800 Message-Id: <20190708123409.12219-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/thermal/rcar_gen3_thermal.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c index a56463308694..755d2b5bd2c2 100644 --- a/drivers/thermal/rcar_gen3_thermal.c +++ b/drivers/thermal/rcar_gen3_thermal.c @@ -443,9 +443,8 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) if (ret) goto error_unregister; - ret = devm_add_action(dev, rcar_gen3_hwmon_action, zone); + ret = devm_add_action_or_reset(dev, rcar_gen3_hwmon_action, zone); if (ret) { - rcar_gen3_hwmon_action(zone); goto error_unregister; } -- 2.11.0