Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2754390imj; Mon, 18 Feb 2019 11:33:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IZPAKjKu+qQU5KxcCRMkMqHk45lVF7nuxy9Dgg45lrHRp4TtMFdnEp42fLf3Aixl2oROraS X-Received: by 2002:a63:2682:: with SMTP id m124mr19139316pgm.35.1550518431691; Mon, 18 Feb 2019 11:33:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550518431; cv=none; d=google.com; s=arc-20160816; b=umpwb9N+dSlY73Hw4empc8m1lRzEnm4ga6xUZ8Xu1wiQti5VBv06WsVDl6x9pYRYd6 5FsPFXzhnlduRAkelhOaG/9j/+/rptTViyvnAdCy8c8ereUwzjWgViUjwv9pS3vSptOd HxceiH995EPBqNpB7FdoClvgLuv1BWQs21Rklf+kwtk9y5c5gP8Zcn0kXuVx6/Y8LqUy tmZcXkGtT2jpQoPV9z9vxojf3mB/1/szVGoq7X/tUP9LjuEC6kK0ZeUqTTu+4fG9TsqP IY07jlS3f0ZGB074ayKWhVFq2EYw73NOgV3L2AWVW21BDiJ/9xXwbsOCKuBO8XH5Q/kq 21bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mFyxx3coigLXIUnYrMNDcJ8yS3ex13/5C2k6HQrWOzQ=; b=cJfNNkRTtb2PAb69ZAwDBlfNODjW+Esfr1BufQDAqvlSTZrqKlOrx98WYt+yuiiG5A FfBW5Wmg4a9KZqH73sAVcUgb0OGmP0fqpdIgGVzd0LbvthlUZPFpJvyFl8WKVqRmUGgc sdJjblYcJ56Y+itJPQv/ruNHic5i/VfPjfZ/oEfp3ymcgNL4I5K1l3qmxbSBHzMhR/XH AzUdhBR5goMHhwzTI3oigjpfAYq0Iqm1m/kOUAYenuToKJzO0FoiuWIHYLKmr5bRiBhd IoBpjQSRbfojKNWXK3wKOa6Tkn0Qw9b9q0RAj0R+kF1ekc4ehBjcSuyBvYSVH3S2IDRq IhCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="j/2zmTJI"; 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=pass (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 p9si13886949pgc.448.2019.02.18.11.33.36; Mon, 18 Feb 2019 11:33:51 -0800 (PST) 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=pass header.i=@gmail.com header.s=20161025 header.b="j/2zmTJI"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728890AbfBRTMb (ORCPT + 99 others); Mon, 18 Feb 2019 14:12:31 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42245 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728721AbfBRTMO (ORCPT ); Mon, 18 Feb 2019 14:12:14 -0500 Received: by mail-pf1-f194.google.com with SMTP id n74so9028545pfi.9; Mon, 18 Feb 2019 11:12:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mFyxx3coigLXIUnYrMNDcJ8yS3ex13/5C2k6HQrWOzQ=; b=j/2zmTJId//3kAJHI4zqwJNlTgSIlBOaeR9MScVESdrnORq1CO8/zgxGVb3riMldIt bteltu/2LuE2xTWm36jS+AMfD1Ylf4YOoqStlcJmJQfwV6TRNAiKFziimhwnFjzRNo/k OjvLOFqBHp64Io8XqQVsW+2H2UdOQPupazwLhgAGqQm3cUW2qNgw9UA7M4z/DB2Qbut9 S5YA/89qAPoCFz62mbzrnRLqYSVGAKSHrwlFQ+Kv6QMixPl52x+xq5HopS0HNrBh0n4m KeJVEHELKyMf5LvNvgb4J3x12/Is19UTp7r/Nj5CCGLBOPUaquxdIyEmixKQJigB61zL uJpg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=mFyxx3coigLXIUnYrMNDcJ8yS3ex13/5C2k6HQrWOzQ=; b=U+Whf7WaAb7xhlHtnEHBPjoVfMbXwdH+GzU7zP7Q2/0rQ6K014B8IUKa8Rr4od3eUL FfotE4DlmscrVqPxgAKowhNwRJeMA0/3FJc4xo++LKPWOjSUl7/SZhkzbRbX9nN7bdl5 zDaVV80PTNVDSosi119qPEGDIPmLsBcp6OPIaIe8oVHtI71N8GzFP3aG3XEQLCkUnuk7 9Jv2LHRSxJSMV7KXmqqzsT1b6bqR3PQl8EBTVQMknchRkVCPhGPCnfqBm6VJdYuc1uLH 5dpdjBDGFoARu5lHeLT9qeHsTZ9594Z7pUT9akX6OrNRNjPeclPkTVloGyryOMdOwDK8 K7Wg== X-Gm-Message-State: AHQUAuY8JX1XVfzA3jgkXZmkv+1zdFHsrTzHu98m5XEEW+YrxjVYrqqK i2xvX9fS0rOokCaBAzJFqbA3z2EF X-Received: by 2002:a63:ed0b:: with SMTP id d11mr6249465pgi.435.1550517132457; Mon, 18 Feb 2019 11:12:12 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id t12sm33189727pgq.68.2019.02.18.11.12.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Feb 2019 11:12:11 -0800 (PST) From: Andrey Smirnov To: linux-pm@vger.kernel.org Cc: Andrey Smirnov , Chris Healy , Lucas Stach , Zhang Rui , Eduardo Valentin , Daniel Lezcano , linux-imx@nxp.com, linux-kernel@vger.kernel.org Subject: [PATCH 10/12] thermal: qoriq: Simplify error handling in qoriq_tmu_get_sensor_id() Date: Mon, 18 Feb 2019 11:11:39 -0800 Message-Id: <20190218191141.3729-11-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218191141.3729-1-andrew.smirnov@gmail.com> References: <20190218191141.3729-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use goto to avoid repeating resource deallocation code. Signed-off-by: Andrey Smirnov Cc: Chris Healy Cc: Lucas Stach Cc: Zhang Rui Cc: Eduardo Valentin Cc: Daniel Lezcano Cc: linux-imx@nxp.com Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/thermal/qoriq_thermal.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c index 3d520d3b2da4..d4f5e180e1ee 100644 --- a/drivers/thermal/qoriq_thermal.c +++ b/drivers/thermal/qoriq_thermal.c @@ -78,9 +78,8 @@ static int qoriq_tmu_get_sensor_id(void) "#thermal-sensor-cells", 0, &sensor_specs); if (ret) { - of_node_put(np); - of_node_put(sensor_np); - return ret; + id = ret; + goto out; } if (sensor_specs.args_count >= 1) { @@ -91,7 +90,7 @@ static int qoriq_tmu_get_sensor_id(void) } else { id = 0; } - +out: of_node_put(np); of_node_put(sensor_np); -- 2.20.1