Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp996815yba; Thu, 4 Apr 2019 02:03:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZJmnU4yu9jsxX4523Prfje0NZVYJtku92wYy5TGtl2Dwpnnk4h+RPmy/o4YcgyPoqfKL7 X-Received: by 2002:a62:59cb:: with SMTP id k72mr4676917pfj.111.1554368591838; Thu, 04 Apr 2019 02:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554368591; cv=none; d=google.com; s=arc-20160816; b=GHYONIujE34NNyo9LlnNPdieeiPFPnbY1NZv1dHfRxWpqfbOLtyDExdYPeQSztmakh S4sPGCd6vJStkh339AdAXe3sNkiwrzhLCoc2D+M10BKLN5ZD9Z0YGcAHJghwBYpLsoQu WQ7JIDPzk9MBCncJI+9o9tyZ0jNM5msaD8y6VTDDhkwotqAwYO1Se488s3hwPnw3J620 5dfuktfIenO/ZDD3vqdAxXgSt8/32TbWi+S4vFDTr36DQjIHFhvWWGuDnZ/3OEKc0mpz /Jwnq9AVq6FL2MQvD5jwypGVONbIKE+Cw2vU5+sgsHet30m22tVBpFjDwCp2/BYSWizp j4dA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VtG6BkNZoSobZPKLp3UTXIyEncZ4/ENmwoMnCD64Ue0=; b=QRMt0nXPCgluDi0UxtHxPrgWpBW+7eBgTkvvPGaFg66iIpoDSuS9WGKZPSO9yQCs8E WxnPRQhK5MXxCuyZSX9r/VPxArNa+sRHTKwA0riQDErCIMo1mFqP6cuso4DFOo8KcoVL PpOkE+hCMNdszafLAr60algJKe6fzLp/uYC0QoKa/kSKke7ls4TQm1eHw3S/mlJDTU2O MM9HPEiSsm5I5Tbu32uqCkrNBLQGMfDqmUtN9EFkHPfAJTAegSZFjv6UF2HFmMnoEbUV QrhA76WSD0cBa3ddZqrROcsY9r8/+0zUHwUJcAcabyYAtE5nPc4mQzCdM0yj3ANXJP7d ld4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1NxZoyTQ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62si69369pla.124.2019.04.04.02.02.56; Thu, 04 Apr 2019 02:03:11 -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=1NxZoyTQ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731380AbfDDJBK (ORCPT + 99 others); Thu, 4 Apr 2019 05:01:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:38130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731366AbfDDJBH (ORCPT ); Thu, 4 Apr 2019 05:01:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 719E5218C3; Thu, 4 Apr 2019 09:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368466; bh=TtqV8WbBIEPsRE9CpvdwyEprEldCGqgjbSWCyMX2BBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1NxZoyTQs3mkqmQHCl2xE2RMVM6qcLphWg9noIOxd7zWDP0CNi7ue07iVFoNQmtFt iEh/ETdshG5qDq4lCoqCszUZjoHFaInuq81136EQfzGp2/uOpgYiA24h6LZCV+K49I nW3jaVuy1aZnM3uheodNW1UJf/vqDONOLElUsi+E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Herbert Xu , Sasha Levin Subject: [PATCH 4.19 050/187] crypto: crypto4xx - add missing of_node_put after of_device_is_available Date: Thu, 4 Apr 2019 10:46:27 +0200 Message-Id: <20190404084605.435107333@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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 5e63742b0d22..53ab1f140a26 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