From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) (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 D434734545 for ; Sat, 23 Nov 2024 19:35:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.84 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732390550; cv=none; b=m8W8nf/hMkAIJlbcpg1V9Rn5/CX5nTc3gMEh4IAc4tM6fRCCkpidLt98DBkVDbqJU7JXrl41aZOngflBQvgafZ+/XqwyyNevdNONAcgNN6iQrn5eMxfLfyJV42JNFwcuoMD8LCYk1YaF5qA2ZHv/ph+6mf1a1QFSLY5A5VpIg9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732390550; c=relaxed/simple; bh=YRirA4MXdQw/rHvtA9UpRe/USgQqYAq3s37L+XXUmx4=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dbSQ0fdjvG1BRGWJxS+kmVavWxRho64V+y/1BX6fk4SSwEXn6mfBcQUwpc2riimCGz4oGHukGWiAdPJamEd1nsFwQR49DPr8MnFFf9WoN1FdWY2lUuYt+NxVvmQqOx7DXmJ19Oy8JD1+fd0BD2p9JYIK3zRNf3qZ8qj896qLwbc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-25-143.elisa-laajakaista.fi [88.113.25.143]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id 1d611df1-a9d2-11ef-827a-005056bdf889; Sat, 23 Nov 2024 21:35:38 +0200 (EET) From: Andy Shevchenko Date: Sat, 23 Nov 2024 21:35:37 +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 07/18] leds: gpio: 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-7-95c0614b38c8@gmail.com> Precedence: bulk X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-7-95c0614b38c8@gmail.com> Fri, Sep 27, 2024 at 01:20:58AM +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 (IS_ERR(led.gpiod)) { > dev_err_probe(dev, PTR_ERR(led.gpiod), "Failed to get GPIO '%pfw'\n", > child); > - fwnode_handle_put(child); > return ERR_CAST(led.gpiod); Here you may use dev_err_ptr_probe() > } -- With Best Regards, Andy Shevchenko