Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp170349lqo; Tue, 7 May 2024 16:29:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX0RyUByRMpcAlkQfAF/tWN1OHusab6PAKLXeSAFg+x8S+u5UoXIz2zxgdePrn/h0mlvLu3vOyBuN4jSLWnhiUWpII1A8LvR9qBGImYmg== X-Google-Smtp-Source: AGHT+IG7FPneVQX0d3Q41lA9gqWobsxZ40VVMWkST8yEvktheGn0Y3LmPhaDEgUZTfqo1YETn53s X-Received: by 2002:a17:903:28d:b0:1e2:3720:e9b4 with SMTP id d9443c01a7336-1eeb078ff3fmr11635815ad.54.1715124595873; Tue, 07 May 2024 16:29:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715124595; cv=pass; d=google.com; s=arc-20160816; b=HneHzrY1i2Gpp3Dh/3MztmYzBqWaOipfKgsk6RWonQFeGpXfODzeVPUbCRVXKvly6Q zuIB5agmmkdpv9Y3nlCQjERuxE4PXM+BES4wR9TUaOUM2eIgFFJ8fS2EMfqwgVSBBf9T RFK8Ie3/NlRu1iInmK7pqVEd97mu1Thb43Dz4Xab7rjsDpfOJBWFXSfEl2brpThr4XVC d5KCPfIKGwgaVmqkNT7KlNlOMHcP5CfeA+wNM4Eupb2Cjc78uOvj4R6a5V0GrUMQLMCE EmhFmKRCuNeEl03brS/SlvkhRbjnRKVMsCTx8GwxLQoh/3ydi+oiM0QzRVgt9JX8YmqX dP5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=RNIouF/xe1/PaZU1WCmemmKZUWlhxytl6448EEBPaxU=; fh=oyC5SeR0Tl+gYGyQeAOtl9fNhI+x6Sn13ApN5aHnfww=; b=EUCtUrIhWYIBFRK4yJrptL9VQpKMB52l/XGN332t8PgxOD2zxqOL35Hkryn/uL25sd X+zJWnectgq/EPuR4ho2vt9cZSybKFXGNlkPNlrmRWRR6nWRKSZ7iNCfZhn3483U8/FS F/Pt8l1G8lXvEa8snzKM0aDMMzeMGFTfTDZ0ACjqBo8CkSmLtVLE7YgZC3QlzwmceLIZ hh3ry4B9+GogG9KGHyM3jX5O7WoJ5ekdDbbuTFnvAk0QKrX2yop0nJTlCemUgfEamtOp WKXBHJZZBQc2RWhPLeD0+ldhpMpmrl0b+S2nhFbfXm8cfKMewQlu1XS3nthpzanPNW+a FaWg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bWT34EwK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172374-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172374-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 e15-20020a170903240f00b001e01d62454csi11778013plo.56.2024.05.07.16.29.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 16:29:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172374-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=@kernel.org header.s=k20201202 header.b=bWT34EwK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-172374-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172374-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 7E5A528123B for ; Tue, 7 May 2024 23:29:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0C85142E7C; Tue, 7 May 2024 23:09:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bWT34EwK" 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 EF6801350FE; Tue, 7 May 2024 23:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123342; cv=none; b=lS0cT2E7m9OuOfuP2l/cfQ3NsDaezCLd8tLSiNtnpGoUkqWnjDnPKXyOGCtLgYELvA82Z95fBgSHQelnSyvGq4tNOESzZZi8+uwJi28jb1zAeHhlRjyVF4s414ocNdRR6NrQNVJo1uV5b815ZwsGGzSJFNFVcfe5fyhg5YMBRNk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715123342; c=relaxed/simple; bh=pPFNJgP3ExZbYzaB6+JINPbSJcoMbjgUMEOefaHD+I4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YbxHERJdQvtCwYw+5KhE6XsymeuYZMv/qhELCSRnYGXU7UMO+7P030eCWopc+Hvg14U9sQzaOm3p80WNw4G1cp0/AZZ4IuozxA9HuytbYLq3OAmbOYOEEkd8Z6t60oVDPmcdW5/7ICCttA0L8lffG8TOeOrG38aXcaoWrvHkwvQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bWT34EwK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10E47C4AF67; Tue, 7 May 2024 23:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715123341; bh=pPFNJgP3ExZbYzaB6+JINPbSJcoMbjgUMEOefaHD+I4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bWT34EwKl5Byc5O8ZWi4tiAeMrq/FpFMfinQpQlgBPUkZymd7NgDOU/4kNFO0jgNS aODF2YXynBnhn4Tl14FhQZX+AOS0FIIEEv87oxU95ktCm3oZ59OVvfZUj6lGxwnGBb YeHgQXLBd9aSni8ridvUtoKzsIXwaf4JKLmJmysEEjsAa4rHTpm9X7lEjxVBGDVQ6X KEqKzsmGORkzv3N3E6Z0B7tpoXj+DK7wfUktma/ggTUraqwVooVBEtRfiikBOHPh7Q BLMAHuLheYRGdGkl3AbTFnAwj+0+IYsIhnXT8K3ugrV2FY2rRGxgqods3j1uOssAKX JmLAGUa+N037Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pierre-Louis Bossart , Mark Brown , Sasha Levin , james.schulman@cirrus.com, david.rhodes@cirrus.com, rf@opensource.cirrus.com, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-sound@vger.kernel.org Subject: [PATCH AUTOSEL 6.8 32/52] ASoC: cs35l56: fix usages of device_get_named_child_node() Date: Tue, 7 May 2024 19:06:58 -0400 Message-ID: <20240507230800.392128-32-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240507230800.392128-1-sashal@kernel.org> References: <20240507230800.392128-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.9 Content-Transfer-Encoding: 8bit From: Pierre-Louis Bossart [ Upstream commit fbd741f0993203d07b2b6562d68d1e5e4745b59b ] The documentation for device_get_named_child_node() mentions this important point: " The caller is responsible for calling fwnode_handle_put() on the returned fwnode pointer. " Add fwnode_handle_put() to avoid leaked references. Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20240426152939.38471-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/cs35l56.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c index 6dd0319bc843c..ea72afe3f906f 100644 --- a/sound/soc/codecs/cs35l56.c +++ b/sound/soc/codecs/cs35l56.c @@ -1297,6 +1297,7 @@ static int cs35l56_try_get_broken_sdca_spkid_gpio(struct cs35l56_private *cs35l5 "spk-id-gpios", ACPI_TYPE_PACKAGE, &obj); if (ret) { dev_dbg(cs35l56->base.dev, "Could not get spk-id-gpios package: %d\n", ret); + fwnode_handle_put(af01_fwnode); return -ENOENT; } @@ -1304,6 +1305,7 @@ static int cs35l56_try_get_broken_sdca_spkid_gpio(struct cs35l56_private *cs35l5 if (obj->package.count != 4) { dev_warn(cs35l56->base.dev, "Unexpected spk-id element count %d\n", obj->package.count); + fwnode_handle_put(af01_fwnode); return -ENOENT; } @@ -1318,6 +1320,7 @@ static int cs35l56_try_get_broken_sdca_spkid_gpio(struct cs35l56_private *cs35l5 */ ret = acpi_dev_add_driver_gpios(adev, cs35l56_af01_spkid_gpios_mapping); if (ret) { + fwnode_handle_put(af01_fwnode); return dev_err_probe(cs35l56->base.dev, ret, "Failed to add gpio mapping to AF01\n"); } @@ -1325,14 +1328,17 @@ static int cs35l56_try_get_broken_sdca_spkid_gpio(struct cs35l56_private *cs35l5 ret = devm_add_action_or_reset(cs35l56->base.dev, cs35l56_acpi_dev_release_driver_gpios, adev); - if (ret) + if (ret) { + fwnode_handle_put(af01_fwnode); return ret; + } dev_dbg(cs35l56->base.dev, "Added spk-id-gpios mapping to AF01\n"); } desc = fwnode_gpiod_get_index(af01_fwnode, "spk-id", 0, GPIOD_IN, NULL); if (IS_ERR(desc)) { + fwnode_handle_put(af01_fwnode); ret = PTR_ERR(desc); return dev_err_probe(cs35l56->base.dev, ret, "Get GPIO from AF01 failed\n"); } @@ -1341,9 +1347,12 @@ static int cs35l56_try_get_broken_sdca_spkid_gpio(struct cs35l56_private *cs35l5 gpiod_put(desc); if (ret < 0) { + fwnode_handle_put(af01_fwnode); dev_err_probe(cs35l56->base.dev, ret, "Error reading spk-id GPIO\n"); return ret; - } + } + + fwnode_handle_put(af01_fwnode); dev_info(cs35l56->base.dev, "Got spk-id from AF01\n"); -- 2.43.0