Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2551426imc; Sat, 23 Feb 2019 05:59:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IYYLY7GigGayDDLXV/6X3CNPIQ4rjCRxfBqTKMw7ANx7S6d7R3SbSuhTCfpzpIiR48xBNHp X-Received: by 2002:a62:569b:: with SMTP id h27mr9356989pfj.163.1550930369611; Sat, 23 Feb 2019 05:59:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550930369; cv=none; d=google.com; s=arc-20160816; b=qBx++1/CGGGRhKC5lswlFLvVFlD5ND58FokZLqgcr29ZfBKbdw8g26hVOXB9Zyc8Nc IZlRnbFawKgq4OZxbYuatEalnvSLwXDJoyJqK4ICB0M2PAvMMuUCsNwHtOeAGubpV94v YhP0sGxg8X1v4JMgVJWrhLx06kEWSIWzW/MyAbsBQB0nIpL/8cSo0i5MUG/D0f66LHhl gAm1D+Do1qJPe+J9ibZHm3AHyIUadSu9cSml5JI5ruJ8iE224L8Ix8ofi78M4N+Tu9y4 TIQA97LUXa+ATsTtwuuA2v156qhdl7+LfH7krGtvjA+QUteKwMLbytOZAj0J3iqU08gV FP2g== 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=ul7P69ousAcLr+sb+zUIyT4K2S7EdFOoeGZX28I5YNY=; b=V1xRK2R4nf5DFFDKCQ8ffThIjxc7wCftf243VkgNTxcgWjwO8brFBKHIQSjUq6EwQv XEB5BNo1wbkLBetUv+D/M/Z++1yG60vu2yMEHzSH9qa9j4npGfOkM5Mcovvw+PYDd2ln xKH5Ij47zlQwzRabO5j57Y97gbaXowITakOe+G06dK89JDQfQ8XN35bdkQFBJl9NCWgt OxsX9lu5Q3jIgOA2pwa4fRwwaJrVx728whI1Kx8lK91PWZhp+FOJS13eD7BvO71hqI6m NU5yL7Uhr4c0Ha0aKS5XfUh2mDXiqjZroUVDtUhODaho1APYxJXZow9YLWmZ/LOutXgM Jh+g== 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 i11si3845645plt.280.2019.02.23.05.59.14; Sat, 23 Feb 2019 05:59:29 -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 S1727976AbfBWN6u (ORCPT + 99 others); Sat, 23 Feb 2019 08:58:50 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:17560 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727883AbfBWN6t (ORCPT ); Sat, 23 Feb 2019 08:58:49 -0500 X-IronPort-AV: E=Sophos;i="5.58,403,1544482800"; d="scan'208";a="370609502" 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: Scott Wood Cc: kernel-janitors@vger.kernel.org, Kumar Gala , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/12] PowerPC-83xx: add missing of_node_put after of_device_is_available Date: Sat, 23 Feb 2019 14:20:34 +0100 Message-Id: <1550928043-14889-4-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: c026c98739c7e ("powerpc/83xx: Do not configure or probe disabled FSL DR USB controllers") Signed-off-by: Julia Lawall --- arch/powerpc/platforms/83xx/usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -u -p a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c --- a/arch/powerpc/platforms/83xx/usb.c +++ b/arch/powerpc/platforms/83xx/usb.c @@ -221,8 +221,10 @@ int mpc837x_usb_cfg(void) int ret = 0; np = of_find_compatible_node(NULL, NULL, "fsl-usb2-dr"); - if (!np || !of_device_is_available(np)) + if (!np || !of_device_is_available(np)) { + of_node_put(np); return -ENODEV; + } prop = of_get_property(np, "phy_type", NULL); if (!prop || (strcmp(prop, "ulpi") && strcmp(prop, "serial"))) {