From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 742BCC433F5 for ; Mon, 17 Jan 2022 17:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243282AbiAQRMN (ORCPT ); Mon, 17 Jan 2022 12:12:13 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:56332 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243023AbiAQRIH (ORCPT ); Mon, 17 Jan 2022 12:08:07 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 37434B81055; Mon, 17 Jan 2022 17:08:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56C22C36AEC; Mon, 17 Jan 2022 17:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642439284; bh=DBhoTDsqf5w5ZsFacLKJcbmnshW2rD6yux0NBPC2nTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXQ6sf6843MMj/EMtO/MMuH0ELSUwHtW6cZ8niVJ3YdfO9RUezuhlmOF/w1d8UgHF +fvU2yhHASfUAQ40v8XsotpNyQ+DqN4Ae/o3y8ut2mpYrhfKNcpPIMmUtA3DfhKZ9U QwKIjWe8hsNgGfP0cK1jB8LZhviMAnsco/Pib5ml7fTXm9qzCRq+w82/r3kNvcgfIw qPAJNs3R9rFlps1FwDVNH+txDtg7AQVgeT5zjEo5icB/mJ4KKDW3n9bml9E3EB9Gxg fYjm8JmMEca6UfdGaeSUSZRrQKXwhQzA3cOWhdb2O2e81zBMcAJKRIkEM50bfbewKn mZ3QmSrixw41A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Julia Lawall , Michael Ellerman , Sasha Levin , linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 4.4 03/12] powerpc/cell: add missing of_node_put Date: Mon, 17 Jan 2022 12:07:47 -0500 Message-Id: <20220117170757.1473318-3-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117170757.1473318-1-sashal@kernel.org> References: <20220117170757.1473318-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Julia Lawall [ Upstream commit a841fd009e51c8c0a8f07c942e9ab6bb48da8858 ] for_each_node_by_name performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ expression e,e1; local idexpression n; @@ for_each_node_by_name(n, e1) { ... when != of_node_put(n) when != e = n ( return n; | + of_node_put(n); ? return ...; ) ... } // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-7-git-send-email-Julia.Lawall@lip6.fr Signed-off-by: Sasha Levin --- arch/powerpc/platforms/cell/iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 14a582b212745..4edceff5791ad 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -1107,6 +1107,7 @@ static int __init cell_iommu_fixed_mapping_init(void) if (hbase < dbase || (hend > (dbase + dsize))) { pr_debug("iommu: hash window doesn't fit in" "real DMA window\n"); + of_node_put(np); return -1; } } -- 2.34.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3D5AC433F5 for ; Mon, 17 Jan 2022 17:44:10 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JczmT3GkKz3fLh for ; Tue, 18 Jan 2022 04:44:09 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=FXQ6sf68; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:4641:c500::1; helo=dfw.source.kernel.org; envelope-from=sashal@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=FXQ6sf68; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Jcyyt1b6xz3dlv for ; Tue, 18 Jan 2022 04:08:06 +1100 (AEDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 917BD61248; Mon, 17 Jan 2022 17:08:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56C22C36AEC; Mon, 17 Jan 2022 17:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642439284; bh=DBhoTDsqf5w5ZsFacLKJcbmnshW2rD6yux0NBPC2nTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXQ6sf6843MMj/EMtO/MMuH0ELSUwHtW6cZ8niVJ3YdfO9RUezuhlmOF/w1d8UgHF +fvU2yhHASfUAQ40v8XsotpNyQ+DqN4Ae/o3y8ut2mpYrhfKNcpPIMmUtA3DfhKZ9U QwKIjWe8hsNgGfP0cK1jB8LZhviMAnsco/Pib5ml7fTXm9qzCRq+w82/r3kNvcgfIw qPAJNs3R9rFlps1FwDVNH+txDtg7AQVgeT5zjEo5icB/mJ4KKDW3n9bml9E3EB9Gxg fYjm8JmMEca6UfdGaeSUSZRrQKXwhQzA3cOWhdb2O2e81zBMcAJKRIkEM50bfbewKn mZ3QmSrixw41A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 03/12] powerpc/cell: add missing of_node_put Date: Mon, 17 Jan 2022 12:07:47 -0500 Message-Id: <20220117170757.1473318-3-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117170757.1473318-1-sashal@kernel.org> References: <20220117170757.1473318-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit 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: Sasha Levin , Julia Lawall , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Julia Lawall [ Upstream commit a841fd009e51c8c0a8f07c942e9ab6bb48da8858 ] for_each_node_by_name performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // @@ expression e,e1; local idexpression n; @@ for_each_node_by_name(n, e1) { ... when != of_node_put(n) when != e = n ( return n; | + of_node_put(n); ? return ...; ) ... } // Signed-off-by: Julia Lawall Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1448051604-25256-7-git-send-email-Julia.Lawall@lip6.fr Signed-off-by: Sasha Levin --- arch/powerpc/platforms/cell/iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 14a582b212745..4edceff5791ad 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -1107,6 +1107,7 @@ static int __init cell_iommu_fixed_mapping_init(void) if (hbase < dbase || (hend > (dbase + dsize))) { pr_debug("iommu: hash window doesn't fit in" "real DMA window\n"); + of_node_put(np); return -1; } } -- 2.34.1