Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5582093img; Wed, 27 Mar 2019 11:06:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqygQNw0UEeMdeXF+dO47WWvRMj+VuUU82E2aiD6a2BdoF8NlUf0dXXZIlQUeAbSCfCn0aUM X-Received: by 2002:a17:902:234b:: with SMTP id n11mr38792169plg.89.1553710013605; Wed, 27 Mar 2019 11:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553710013; cv=none; d=google.com; s=arc-20160816; b=cXqMC9wbj3FR7boJztAcRV1nF3H3XfXIIptJ26jddl906zRU4mgfbhd96bWXjounqy O+OQbmb4wflg7JeBJ4RpS8VXzC9wDhIACdYxlAOHEfh7FVw3GxOO+P1nXmfv+7qNPzmo m9vzItQOfutbDp73IwcT/wniPpA2Zv21u4WlRdzoWjNrQWklH3dSx6BaGPAFyFYWh7nd EDp9DDK/qg+/tfx/zb1DD02wGLQWEEfzIs6RyQTBeNb8tD8hHmZjjapMr9ta1xmLZWjZ io20qH3uFIBqcDeepJy1wUsfqYuSy0YPDtZCbPgw9fas3OhLpSpqFbGg1hFSxr1boEW2 eVgw== 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=AGrTB8GjTlki78X+b06/Rh5fGIbaRwKkLfNDR0uh5Io=; b=I2wNqormWn+DkVKlVVn8eX/P3Tt4v/nHOUK42qNkqLDZVJI6N2EvGb9CUJp8TQw26F wZYbyPAYwTuAplZx1QQnZWykFncOtES2X/fMx35NHAD76Tlp7693AE0ZLjmKojPxwv7f V/iPxSTtTQ5mSGtqPt2LKta/PL4b/ilCc+tfBU49aTVUMVTnq+st3wJNnTl2byDNqyeP ERCfnAlMmaz2gaX1pcWJN/UdpnJOS/IoNaByfs+KXVFIUqqH+AxWYAWL1ks9/PYq91kE quhQVJovN6OV3KzZ/4TW4V8RJn8wQTu9scutJEOXquckcFf+2cVqkJ10txv2XhcObXq0 JwCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=z5+2twr5; 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 x8si15067523pgx.484.2019.03.27.11.06.38; Wed, 27 Mar 2019 11:06:53 -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=z5+2twr5; 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 S1733088AbfC0SEB (ORCPT + 99 others); Wed, 27 Mar 2019 14:04:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:44416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730385AbfC0SD6 (ORCPT ); Wed, 27 Mar 2019 14:03:58 -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 488EA2075C; Wed, 27 Mar 2019 18:03:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709838; bh=1DoeZeAmhz5vnmPgc0iStjhMBU9n/Iennb9MIbXakDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z5+2twr5Pf05DyBdQzH4iiEJaalQAJHWBbGpnyvWlx3qjrUqckBlZ/K936PA9T0K3 pLeTKSEk1FGBirSO9liU7YoKwmaMoVcHazJ857qWHIf8cnGiB8WvW/jwIBnrmNd6ut hoChlp9z7T+vfFCpvkm/shhYxvGugWMlafO5Sv4g= 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 5.0 067/262] crypto: crypto4xx - add missing of_node_put after of_device_is_available Date: Wed, 27 Mar 2019 13:58:42 -0400 Message-Id: <20190327180158.10245-67-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-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 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