Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5614687img; Wed, 27 Mar 2019 11:45:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwT9my4aqRZ99DYA88QjJk+PquAXdQ43cmlE70yAo0XmEBzHTEFDNMZv8vEUZkLAMBABB+i X-Received: by 2002:a65:4247:: with SMTP id d7mr17585929pgq.114.1553712313332; Wed, 27 Mar 2019 11:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553712313; cv=none; d=google.com; s=arc-20160816; b=xCfrzgRd5LqnzDGpX2mhe9WZjZUX/EBRVsDgOEFfzcSf0D5hZytG1LQSFlAbmzHPDd e0r4CMeSF7QPnFrkN5I1vD2uYxJBghmWetuJxIRXRhyOpPCAIaoI/b5qVjczXdIPlM7t JnS4U34KTWLV0Py7fTEf/T/gIUFvz3LHlqJgDiD66J8p9/x8GIzuImLIwrHLXeI7s7bg J09rHzHLNN9+XjZY1sPqh65ocQ1aD15v/1rit4BGJWpGwNBFzOVPVKp2Kc3y7G2PaYaT 9mQ2Z2g2CD00jfSe/Y9kZ/5jcOWiiGN9vjtbZFFnuDcYxFv7Ucn+TJZBeZFgJczQk39d eaPw== 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=F+TM7VCf0kWWKzGaXmJNZzVxfZreuQIzCAU3MOOWPPY=; b=Q1aO3eOunDPn5BYVqDjYViaBpzKG3fUjO5FBs3LxT06EsMEJiVlYuzwvPJvcV4llXg lCEZsu/hKCPDfjV5FQ8DDJTuBeKoZRHSrxunwkTyD/bnkfUlFsLo3EehBuZk9v+2tJqq zuRo62zLBkhvlfKQUKsZ/8IQwqnyUJD2F9alPmDLw6N2VdBE0ge/pAKZATpTP/4907Do KgX7hl2M9CmT6UPWiDNAwVMW+Ozshn5sjGH70hwzqRz2YNK6+dWpgJ8/BzAv0xKSBdQu beb61qErDvLUY3zaoCLRuX9/8jh/2mav0ozQM9Jt5oY4IyQB+TXsjvQaNIlKJ31tYVBL x+Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VHH1qpO7; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si18438932pfe.194.2019.03.27.11.44.57; Wed, 27 Mar 2019 11:45:13 -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=pass header.i=@kernel.org header.s=default header.b=VHH1qpO7; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391185AbfC0SVa (ORCPT + 99 others); Wed, 27 Mar 2019 14:21:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:39248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391159AbfC0SVY (ORCPT ); Wed, 27 Mar 2019 14:21:24 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3A76D20651; Wed, 27 Mar 2019 18:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710883; bh=kvkCwcHxhjJCvdDnaatwvmnKYzQOI7wCcLz8mpqrU+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VHH1qpO7H6GY9XoKrQRy3MXEPTvaoIf9lqTQ/y0fsJJtD9qwGpPHLDjaEIggw5AhI at7rCULtFYdRXy8l435jImqejpJTZseU+5MNVukfDj1VjcAEtZ1jgrij/mDYBngmNJ uQ/bG+2BxXzdMvHtOj8L1dfLEY8kdN6ljuZx/s+E= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Julia Lawall , Herbert Xu , Sasha Levin , linux-crypto@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 25/87] crypto: crypto4xx - add missing of_node_put after of_device_is_available Date: Wed, 27 Mar 2019 14:19:38 -0400 Message-Id: <20190327182040.17444-25-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327182040.17444-1-sashal@kernel.org> References: <20190327182040.17444-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Lawall [ Upstream commit 8c2b43d2d85b48a97d2f8279278a4aac5b45f925 ] Add an of_node_put when a tested device node is not available. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ identifier f; local idexpression e; expression x; @@ e = f(...); ... when != of_node_put(e) when != x = e when != e = x when any if (<+...of_device_is_available(e)...+>) { ... when != of_node_put(e) ( return e; | + of_node_put(e); return ...; ) } // Fixes: 5343e674f32fb ("crypto4xx: integrate ppc4xx-rng into crypto4xx") Signed-off-by: Julia Lawall Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/amcc/crypto4xx_trng.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/amcc/crypto4xx_trng.c b/drivers/crypto/amcc/crypto4xx_trng.c index 677ca17fd223..368c5599515e 100644 --- a/drivers/crypto/amcc/crypto4xx_trng.c +++ b/drivers/crypto/amcc/crypto4xx_trng.c @@ -80,8 +80,10 @@ void ppc4xx_trng_probe(struct crypto4xx_core_device *core_dev) /* Find the TRNG device node and map it */ trng = of_find_matching_node(NULL, ppc4xx_trng_match); - if (!trng || !of_device_is_available(trng)) + if (!trng || !of_device_is_available(trng)) { + of_node_put(trng); return; + } dev->trng_base = of_iomap(trng, 0); of_node_put(trng); -- 2.19.1