Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp924222lqp; Thu, 23 May 2024 04:25:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHGPbPZWrA08CSrpEiu9hXTn+McVxV1zwTf1siKryiKaIXwOoF/Vn4AUe4GU9Oz4vecM88OnrJwhgOPjNhGcUivHmZafwvVrdcpKlT8g== X-Google-Smtp-Source: AGHT+IE6I/QSUM0JHm4DqTUfx58ql3EhQk3yA4AWL8aV0odHrvBhrX+OGSm4gr+2IPv/NCg80qAd X-Received: by 2002:a05:6a00:2354:b0:6f3:e9bc:cc3d with SMTP id d2e1a72fcca58-6f77256293bmr2929499b3a.3.1716463515793; Thu, 23 May 2024 04:25:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716463515; cv=pass; d=google.com; s=arc-20160816; b=nd3wDnmLuhECeCBqVqTND9mEAXncGxAkmfMqXP10ResXyZXFJl/tn4VNoTrqQNo+2t F5q+MhZ2RdtebEcngVLQG6nKY1jdfZekwTsbha2cFQrSTrkxKUWGnyTrBQ+vELzajXWN TW2tvQe7zYcDQqiPZ8pdMwxSwabzYlH3XvWCFRf0DkoD2mXOSvAHkKf7H5GaGdXIvXr3 BJuiOvi5R1Ppl6lu392Ms1bPudXqF1NDYpQ005QvHylBAU/dtzU1P31rGoYyIakKkW5/ or1jIQYwge9qTBIgBLGJx3JMOm8Rz0bg1aMPAtrfTbqcju3U7Nvfl8pJU4ltwCjwY8IA dRvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=xz5HmwISGE6JPRBQj3ZIbQI4h9QCSU4QHSIcfScVatg=; fh=e7RZtY5NgtmqCiNirbFiJTSAJp/7Egpen53A4E8VxHU=; b=zCLqjNkJDjVbSSlbCFKcbimZ92OPRElnqFL6g8U9vj9Fz/LZgm9Q1ymZ1+J5YZrCTq QNXS6ETrDc+zTnLtOKdxiUTIFdwgv49RvMK5tFJC1DucG40nUXoPlM8V3OtpltHL0Mku ruU8jWLNAuqH5da7p+Im9GOjIb7MPgNW210eOH3020n67L6gYOvkBInYqPskasRvRcr0 AfTB+lxwD3dK3LtCB5ZtgvR5UzuoIcmQyDvWSnh/3zlBhafVktxypzXlcTw2/aiiwm6Y lxesCMeW1D+r33ohUbS9T1+bcNDkf4rF8GrC2fLear0M0gp/J71umFnHAQm6gjsZw4m7 URqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=JQLKM0vm; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-187394-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187394-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2aee582si601495b3a.172.2024.05.23.04.25.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 04:25:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187394-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=JQLKM0vm; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-187394-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187394-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 26CAD2834C2 for ; Thu, 23 May 2024 11:25:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D3FE1474B8; Thu, 23 May 2024 11:25:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="JQLKM0vm" Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F41C2746F for ; Thu, 23 May 2024 11:25:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.107.74.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716463507; cv=none; b=Vpc2D4nqFBxVJR9YcQIVJlLRhuSuyiRPnAGlstSCCE55isex5xd295+X3EFu6K9pd5NTmnQv3RGlTuemVGVICghP/kf4XtZbiKexsGijbgntKLwtnoYQPEZJNV/XFC6f5YCMOHNK0raSr/ryX8nErtzxh/H9ypofxWjsZChSDA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716463507; c=relaxed/simple; bh=wVoiOdM1e88Oro+D0GZXjKOg70saQD3b27grWmj2enM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=BBKHvQr+lwRP+YF3/eO00SxrZLM1Nnh9gt152em1naWN785rp8nBLUk1s5fN63757mq/hNHIlM2vorVDjsKYp4vDrLLB1sk24f+F14jfrkShPL9SAynHfs8kvE7VxT7sQNiSPE80MSNtPb099UjRc6FPX9gGCkxEHeNXynX5O90= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au; spf=pass smtp.mailfrom=ellerman.id.au; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b=JQLKM0vm; arc=none smtp.client-ip=150.107.74.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ellerman.id.au DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1716463503; bh=xz5HmwISGE6JPRBQj3ZIbQI4h9QCSU4QHSIcfScVatg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=JQLKM0vmOL055TJl+XXGRzzbmUvRLCww8tlf6nddVcsrtzh+WvpCorTP+wKrHCjgk CKPEjguPEXgyQ6lX9w4lfTqTk3GV3lUWMf7zFzz4NZGRmNiXA8pfbq6nSKdmi1+rcF 9fjamtltw2z0Y4NHnL94nwlifGqvjyUNaBOdZgz18tmOsxobeguHV6rUnuHuunbaAO G5JdBc6IAQrt+8Bgdbh10jDHGwpcIkcsUmeJYJB+bkyv7BbIAXdR/XucRU/Do9Ivh/ /sa8oFuB6ITwLPSXlbch2gfXNjws6fkbLdLZUXxe+VpOgJ4f2w73grRTKIydwQvOET 3jaBF9LmQY4xA== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4VlQnV2GSdz4wb0; Thu, 23 May 2024 21:25:02 +1000 (AEST) From: Michael Ellerman To: Prabhav Kumar Vaish , akpm@linux-foundation.org Cc: npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen.n.rao@linux.ibm.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, julia.lawall@inria.fr, javier.carrasco.cruz@gmail.com, Prabhav Kumar Vaish Subject: Re: [PATCH next] arch: powerpc: platforms: Remove unnecessary call to of_node_get In-Reply-To: <20240522194250.1165568-1-pvkumar5749404@gmail.com> References: <20240522194250.1165568-1-pvkumar5749404@gmail.com> Date: Thu, 23 May 2024 21:25:01 +1000 Message-ID: <87h6eo3h4i.fsf@mail.lhotse> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Prabhav Kumar Vaish writes: > `dev->of_node` has a pointer to device node, of_node_get call seems > unnecessary. Sorry but it is necessary. > Signed-off-by: Prabhav Kumar Vaish > --- > arch/powerpc/platforms/cell/iommu.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c > index 4cd9c0de22c2..5b794ce08689 100644 > --- a/arch/powerpc/platforms/cell/iommu.c > +++ b/arch/powerpc/platforms/cell/iommu.c > @@ -780,14 +780,13 @@ static int __init cell_iommu_init_disabled(void) > static u64 cell_iommu_get_fixed_address(struct device *dev) > { > u64 cpu_addr, size, best_size, dev_addr = OF_BAD_ADDR; > - struct device_node *np; > + struct device_node *np = dev->of_node; > const u32 *ranges = NULL; > int i, len, best, naddr, nsize, pna, range_size; > > /* We can be called for platform devices that have no of_node */ > - np = of_node_get(dev->of_node); > if (!np) > - goto out; > + return dev_addr; > > while (1) { > naddr = of_n_addr_cells(np); nsize = of_n_size_cells(np); np = of_get_next_parent(np); if (!np) break; of_get_next_parent() drops the reference of the node passed to it (np). So if you actually tested your patch you should see a recount underflow. cheers