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 96195E69172 for ; Sat, 23 Nov 2024 19:32:09 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:Date:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+VIbTwyaBoGicddBdmbfrc9X51L9kzP0D91jG7G3nuM=; b=eV0vq2LBEiO3RvbTOb/up9DPj1 ewmYLLNMvrY2ZSo+4H3F/6EbYc0sIuBo59fFhVKX+Q9yRkvj8LcHIxQnmhKyyEwgzzIET9vaYfxwo yqtWCbXmVRMV4Jq97h1ypZCoC9Q9BrSd+VI4tX60iRI36wpvI8+MjTdScq1VK8eFcU6p3h0M1+C6X eOeV52CYQOvSX/f7EY7z4zIEFq8i1d+02aSbTHWzU+qR9rEAgXmhvK4yZtCOH4yIsYJGS+JqMl7wp u4bp6wAfOO0dbfbsPydYVL/1F0GoWBlin/8YmNsqLNb8cSEE7J8udUqSM5T4XIzhNk5hGiyemIfnz mMWUq90A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tEvrU-00000004mUN-32if; Sat, 23 Nov 2024 19:32:08 +0000 Received: from fgw23-7.mail.saunalahti.fi ([62.142.5.84]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tEvqa-00000004mNA-2JcO for linux-mediatek@lists.infradead.org; Sat, 23 Nov 2024 19:31:13 +0000 Received: from localhost (88-113-25-143.elisa-laajakaista.fi [88.113.25.143]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id 79edaa06-a9d1-11ef-a0f6-005056bdfda7; Sat, 23 Nov 2024 21:31:05 +0200 (EET) From: Andy Shevchenko Date: Sat, 23 Nov 2024 21:31:02 +0200 To: Javier Carrasco Cc: Pavel Machek , Lee Jones , Matthias Brugger , AngeloGioacchino Del Regno , Gene Chen , Jacek Anaszewski , Bartosz Golaszewski , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jonathan Cameron , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH 05/18] leds: cr0014114: switch to device_for_each_child_node_scoped() Message-ID: References: <20240927-leds_device_for_each_child_node_scoped-v1-0-95c0614b38c8@gmail.com> <20240927-leds_device_for_each_child_node_scoped-v1-5-95c0614b38c8@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240927-leds_device_for_each_child_node_scoped-v1-5-95c0614b38c8@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241123_113112_752111_185CCED1 X-CRM114-Status: UNSURE ( 9.10 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Fri, Sep 27, 2024 at 01:20:56AM +0200, Javier Carrasco kirjoitti: > Switch to device_for_each_child_node_scoped() to simplify the code by > removing the need for calls to fwnode_handle_put() in the error paths. > > This also prevents possible memory leaks if new error paths are added > without the required call to fwnode_handle_put(). ... > if (ret) { > dev_err(priv->dev, > "failed to register LED device, err %d", ret); > - fwnode_handle_put(child); > return ret; Now it can be return dev_err_probe(..., ret, "failed to register LED device"); > } -- With Best Regards, Andy Shevchenko