From patchwork Fri Apr 23 14:40:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 1469622 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FRcRL6SQlz9sTD for ; Sat, 24 Apr 2021 00:41:02 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FRcRL5t1dz30Cs for ; Sat, 24 Apr 2021 00:41:02 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=wanadoo.fr (client-ip=80.12.242.126; helo=smtp.smtpout.orange.fr; envelope-from=christophe.jaillet@wanadoo.fr; receiver=) Received: from smtp.smtpout.orange.fr (smtp04.smtpout.orange.fr [80.12.242.126]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FRcR31ThRz2xfy for ; Sat, 24 Apr 2021 00:40:45 +1000 (AEST) Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d51 with ME id wEgd2400J21Fzsu03EgdTu; Fri, 23 Apr 2021 16:40:40 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 23 Apr 2021 16:40:40 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, gustavoars@kernel.org, robh@kernel.org Subject: [PATCH 1/2] powerpc: Fix a memory leak in error handling paths Date: Fri, 23 Apr 2021 16:40:35 +0200 Message-Id: X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, Christophe JAILLET , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" If we exit the for_each_of_cpu_node loop early, the reference on the current node must be decremented, otherwise there is a leak. Fixes: a94fe366340a ("powerpc: use for_each_of_cpu_node iterator") Signed-off-by: Christophe JAILLET Reviewed-by: Rob Herring --- Strangely, the commit above added the needed of_node_put in one place but missed 2 other places! This is strange, so maybe I misunderstand something. Review carefully --- arch/powerpc/platforms/powermac/feature.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index 5c77b9a24c0e..e612222f7d2e 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c @@ -1060,6 +1060,7 @@ core99_reset_cpu(struct device_node *node, long param, long value) continue; if (param == *num) { reset_io = *rst; + of_node_put(np); break; } } @@ -1506,6 +1507,7 @@ static long g5_reset_cpu(struct device_node *node, long param, long value) continue; if (param == *num) { reset_io = *rst; + of_node_put(np); break; } } From patchwork Fri Apr 23 14:40:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 1469623 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FRcRj0hpmz9sW5 for ; Sat, 24 Apr 2021 00:41:20 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FRcRh5TY9z301q for ; Sat, 24 Apr 2021 00:41:20 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=wanadoo.fr (client-ip=80.12.242.126; helo=smtp.smtpout.orange.fr; envelope-from=christophe.jaillet@wanadoo.fr; receiver=) Received: from smtp.smtpout.orange.fr (smtp04.smtpout.orange.fr [80.12.242.126]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FRcR93BrVz2yxS for ; Sat, 24 Apr 2021 00:40:52 +1000 (AEST) Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d51 with ME id wEgp2400d21Fzsu03EgqWK; Fri, 23 Apr 2021 16:40:50 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 23 Apr 2021 16:40:50 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, gustavoars@kernel.org, robh@kernel.org Subject: [PATCH 2/2] powerpc: Save a few lines of code Date: Fri, 23 Apr 2021 16:40:48 +0200 Message-Id: <0ff6235a4e2d497e146ce401fa2df71449d290b6.1619188632.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, Christophe JAILLET , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 'arch/powerpc/platforms/powermac/feature.c' triggers many checkpatch.pl warnings. The code looks old and not very active, so fixing them all does not make so much sense and will hide some 'git blame' information. So only apply a few fixes that save a few lines of code. Signed-off-by: Christophe JAILLET --- arch/powerpc/platforms/powermac/feature.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index e612222f7d2e..155e8586692e 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c @@ -83,8 +83,7 @@ struct macio_chip *macio_find(struct device_node *child, int type) } EXPORT_SYMBOL_GPL(macio_find); -static const char *macio_names[] = -{ +static const char *macio_names[] = { "Unknown", "Grand Central", "OHare", @@ -119,8 +118,7 @@ struct feature_table_entry { feature_call function; }; -struct pmac_mb_def -{ +struct pmac_mb_def { const char* model_string; const char* model_name; int model_id; @@ -301,11 +299,10 @@ static long ohare_sleep_state(struct device_node *node, long param, long value) if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0) return -EPERM; - if (value == 1) { + if (value == 1) MACIO_BIC(OHARE_FCR, OH_IOBUS_ENABLE); - } else if (value == 0) { + else if (value == 0) MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); - } return 0; } @@ -2992,7 +2989,6 @@ void pmac_register_agp_pm(struct pci_dev *bridge, if (bridge != pmac_agp_bridge) return; pmac_agp_suspend = pmac_agp_resume = NULL; - return; } EXPORT_SYMBOL(pmac_register_agp_pm);