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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 16DA5CA1018 for ; Sat, 31 Aug 2024 10:33:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=MnX/IGVIP89663Ock/GpjByC6wPR8nm9yFoq3qfpgKk=; b=TEBGT14W6KcHFOlLJPX43We2UC dgpdyBcAu5oQQma/8go7eBAOF2v7eNTKJ7sflbzF+T6HL9xM5Le7crzbTIYdMnZE/jjMkpVQD/F1z uVJzKbZBrOvTOF4Zu4N8noAnEi6769F3QlAYbFrxkzQy5TDcTNpJZegKSy1/XzLji08kDviJhCCDb QAzUx11+jO01dTvlxkmfrGe3ofwPo0Lq3GPwqaBUfY2LklAwGnUKY84VizXRcLVgXQS3uTfPTd4gd Sgh85pgaQ+LpI7SMy0EVjRmm18XIzv/2QRUxJHP1KfvDeBb3RLyS2l19fIEgEIiaHN7XLvaqLiR2g tkL+Ca7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1skLQS-000000099Gz-2ffP; Sat, 31 Aug 2024 10:33:48 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1skLNJ-000000098ku-2Qxc for linux-arm-kernel@lists.infradead.org; Sat, 31 Aug 2024 10:30:34 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id AA64FA402DF; Sat, 31 Aug 2024 10:30:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5E1FC4CEC0; Sat, 31 Aug 2024 10:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725100232; bh=6SWTTgTAzp6pqg4Vm4RZubkX3UCuusQwF+vJGG/x2vQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QEffq0MXDsWJWK5sRvImQL8mf+7JPH7FqWXdrsgY3Cd7NXJR8fmTHMuusiYMGnyhC MHZRnQPI2BQBNzCli8vVmgh+dEdC0uxBsz/fRD4SJemPO70j2WI5R14ofbm4VjUpqj kjhuO/TmLT2Aem8eyujuJ1mvRbendpbr22r/NmZB8VHlPSpsUMXOsVwaG1aQ4wijVU RybOdpY2DoFelEtVjQyRLTVrH9HyaFC1lbjOm1n7PKyWOTl8dYcRCY4yp8Qh8GHVki ymaipbd5WA6OB41R7ckuL0rn3ouJJGPlz4pdjabaARYh6JkylN/XBqkaD8dQdf/vUx XFfHdhi7Y3qYw== Date: Sat, 31 Aug 2024 11:30:21 +0100 From: Jonathan Cameron To: Jinjie Ruan Cc: Kousik Sanagavarapu , , , , , , , , , , , , , , , , , , , , jonathan.cameron@huawei.com Subject: Re: [PATCH -next 8/8] soc: ti: knav_qmss_queue: Simplify with scoped for each OF child loop Message-ID: <20240831113021.08a9010a@jic23-huawei> In-Reply-To: <598efadd-da27-0be3-6d1c-dee50e71c811@huawei.com> References: <598efadd-da27-0be3-6d1c-dee50e71c811@huawei.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240831_033033_728246_9476925C X-CRM114-Status: GOOD ( 19.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 30 Aug 2024 11:24:14 +0800 Jinjie Ruan wrote: > On 2024/8/29 23:58, Kousik Sanagavarapu wrote: > > Jinjie Ruan writes: > >> @@ -1080,17 +1080,13 @@ static int knav_queue_setup_regions(struct knav_device *kdev, > >> { > >> struct device *dev = kdev->dev; > >> struct knav_region *region; > >> - struct device_node *child; > >> u32 temp[2]; > >> int ret; > >> > >> - for_each_child_of_node(regions, child) { > >> + for_each_child_of_node_scoped(regions, child) { > > > > Are you sure using *_scoped() is better here? Since it seems that we > > need the memory pointed to by "child" in cases where we don't go into an > > error path. > > Hi, Jonathan, could you help review this code? I don't understand the review comment. The reference counting before and after this patch is the same, just with the error path handled in a simpler fashion and the scope of the child variable reduced. > > > > >> region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL); > >> - if (!region) { > >> - of_node_put(child); > >> - dev_err(dev, "out of memory allocating region\n"); > >> - return -ENOMEM; > >> - } > >> + if (!region) > >> + return dev_err_probe(dev, -ENOMEM, "out of memory allocating region\n"); > >> > >> region->name = knav_queue_find_name(child); > >> of_property_read_u32(child, "id", ®ion->id); > > > > Similarly in most of the other cases in this series where a similar > > change is done. > > > > Also FYI, as for dev_err_probe(), I think I covered all of them in this > > file and a patch for it is currently sitting in ti-drivers-soc-next. > > > > Thanks