Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2551560imc; Sat, 23 Feb 2019 05:59:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IZXphq40/K8c3dmLbZMT7TnjfiMnvhZK7WuUupjSbWEoGhZ+3gtw1R35FKlaAAcxRK74+VL X-Received: by 2002:a17:902:509:: with SMTP id 9mr9340509plf.94.1550930379837; Sat, 23 Feb 2019 05:59:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550930379; cv=none; d=google.com; s=arc-20160816; b=sjdRi4AJkRfsDLAKmJYvmRr2ePDJnGU6VBWNUErKd9eCvbr4gBa1uqRjqvoql9RoRS fL9tHhsyYzLcoG71BmwPvqVwz0QzeUTyEH3AzuKAUoEbK7+s1Q0ZegDKFE6tQVh8e98T 2ERoD9l4TtjvKbN0wwjgnENujM0K/bMd+Z0iS3J3/zvyx+Z08Bw68Wxp6sNDaJRMxyyA hoCDCdvd12VBpKzT7XLm7FCYRHKdmb5vFgsI6Gec1PrSRWDZVgcQxWwcigl0NgdkwJMZ wOoDyS9guE+xcj9NZ+sBFyLXXjCzjPlic4uivKullHRyrocZQlb/43qzVh2SSuPSozOw KHRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=MbX4n4BVGNUCn/ja5nmXRjP5I++Z44At72RTWX3Aj/Q=; b=vPProbYw3R6GyZxmRTAGYfx8jfspwPPElmzSsOayPNVWQnZgS/mtnqv8g8sKxo+zlf LSU+7K/T2FW/rBkwoAl3kVL5GEnN1/VtUOVERliknudpmhCZHRKGe5upiWp0m/8VY4uQ FomcLH0cQP5oUhumDbyFKe2YC2Lc8pNwXYxPSoXzAcMj/AC1zHta9fYt8BFrNF+6EY6g gfki6z6+RoTD3BYaaM/ogEGarlRGoLhFCKDHdT9ozdo+LSnhH6dZ8kL+a5kjozBeQISa JR3GlTO1MqZl2lb42RMxglcanBgfGkroPEw/qbXEZsu8HFpjPihoK7dXuS23r/gnncZ/ Lj3Q== ARC-Authentication-Results: i=1; mx.google.com; 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 w16si415805pgj.217.2019.02.23.05.59.24; Sat, 23 Feb 2019 05:59:39 -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; 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 S1728032AbfBWN6y (ORCPT + 99 others); Sat, 23 Feb 2019 08:58:54 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:17561 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727987AbfBWN6v (ORCPT ); Sat, 23 Feb 2019 08:58:51 -0500 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609507" Received: from palace.lip6.fr ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 23 Feb 2019 14:58:44 +0100 From: Julia Lawall To: Herbert Xu Cc: kernel-janitors@vger.kernel.org, "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/12] crypto: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:39 +0100 Message-Id: <1550928043-14889-9-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1550928043-14889-1-git-send-email-Julia.Lawall@lip6.fr> References: <1550928043-14889-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/crypto/amcc/crypto4xx_trng.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/drivers/crypto/amcc/crypto4xx_trng.c b/drivers/crypto/amcc/crypto4xx_trng.c --- a/drivers/crypto/amcc/crypto4xx_trng.c +++ b/drivers/crypto/amcc/crypto4xx_trng.c @@ -80,8 +80,10 @@ void ppc4xx_trng_probe(struct crypto4xx_ /* 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);