From patchwork Sun Jan 14 17:20:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13519189 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2C56B7472; Sun, 14 Jan 2024 17:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AyrY0fSv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62716C433C7; Sun, 14 Jan 2024 17:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705252882; bh=NBRWPxAsv0p1+ik3CPg3McHiDTSVOihxBd46Tt4L1gI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AyrY0fSvXSmFEfHH7s6M5En1E7DlTOGfPpH9c2EdKIoWLd1I6Qrk5frPgkH4xyfYg nUMXapvqPogwI5rnfsRrxvz4jX5zx8OMFvgSCrcLD7NR7sz/PNJlD8ucNBrZS04eFq UIPz606nVL566NDoZs0j2cNnfbIbEd3Aw2i6h7AOuId33cG+rnpWuDlaMVGyQXKWua LmjOg5GosrHbnsML8M+feoDj7SfssRf4yQ4Bi+M+gDpiszGv2BEnPOsnrokoHo3/Tz cAEAJ5sceltgCckDFJEFdRtaX6ikBHtLI7C6N8J6/ePj4FRgImtEiiVO645QLqIEVU ld0V2h7R9W1EQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, "Rafael J . Wysocki" , Len Brown , linux-acpi@vger.kernel.org, Andy Shevchenko , Greg Kroah-Hartman , Daniel Scally , Heikki Krogerus , Sakari Ailus Cc: =?utf-8?q?Nuno_S=C3=A1?= , Cosmin Tanislav , Mihail Chindris , Rasmus Villemoes , Tomislav Denis , Marek Vasut , Olivier Moysan , Fabrice Gasnier , Lad Prabhakar , Dmitry Baryshkov , Marijn Suijten , Marius Cristea , Ibrahim Tilki , Jonathan Cameron Subject: [PATCH 09/13] iio: addac: ad74413r: Use __free(fwnode_handle) to replace fwnode_handle_put() calls Date: Sun, 14 Jan 2024 17:20:05 +0000 Message-ID: <20240114172009.179893-10-jic23@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240114172009.179893-1-jic23@kernel.org> References: <20240114172009.179893-1-jic23@kernel.org> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Jonathan Cameron This use of the new cleanup.h scope based freeing infrastructure allows us to exit directly from error conditions within the fwnode_for_each_available_child_node(dev, child) loop. On normal exit from that loop no fwnode_handle reference will be held and the child pointer will be NULL thus making the automatically run fwnode_handle_put() a noop. Cc: Rasmus Villemoes Signed-off-by: Jonathan Cameron Acked-by: Nuno Sa --- drivers/iio/addac/ad74413r.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c index 7af3e4b8fe3b..ec9a466e118d 100644 --- a/drivers/iio/addac/ad74413r.c +++ b/drivers/iio/addac/ad74413r.c @@ -1255,21 +1255,16 @@ static int ad74413r_parse_channel_config(struct iio_dev *indio_dev, static int ad74413r_parse_channel_configs(struct iio_dev *indio_dev) { struct ad74413r_state *st = iio_priv(indio_dev); - struct fwnode_handle *channel_node = NULL; + struct fwnode_handle *channel_node __free(fwnode_handle) = NULL; int ret; fwnode_for_each_available_child_node(dev_fwnode(st->dev), channel_node) { ret = ad74413r_parse_channel_config(indio_dev, channel_node); if (ret) - goto put_channel_node; + return ret; } return 0; - -put_channel_node: - fwnode_handle_put(channel_node); - - return ret; } static int ad74413r_setup_channels(struct iio_dev *indio_dev)