From: Davidlohr Bueso <dave@stgolabs.net>
To: rafael@kernel.org
Cc: daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com,
srinivas.pandruvada@linux.intel.com, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, dave@stgolabs.net
Subject: [PATCH 2/3] thermal: int340x: Consolidate freeing of acpi_buffer pointer
Date: Thu, 24 Mar 2022 12:09:49 -0700 [thread overview]
Message-ID: <20220324190950.70486-3-dave@stgolabs.net> (raw)
In-Reply-To: <20220324190950.70486-1-dave@stgolabs.net>
Introduce a single point of freeing/exit after ensuring no error in
int3400_setup_gddv().
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
.../thermal/intel/int340x_thermal/int3400_thermal.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index 0e7931c286ec..e299873d50b8 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -508,21 +508,18 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv)
obj = buffer.pointer;
if (obj->type != ACPI_TYPE_PACKAGE || obj->package.count != 1
- || obj->package.elements[0].type != ACPI_TYPE_BUFFER) {
- kfree(buffer.pointer);
- return;
- }
+ || obj->package.elements[0].type != ACPI_TYPE_BUFFER)
+ goto out_free;
priv->data_vault = kmemdup(obj->package.elements[0].buffer.pointer,
obj->package.elements[0].buffer.length,
GFP_KERNEL);
- if (!priv->data_vault) {
- kfree(buffer.pointer);
- return;
- }
+ if (!priv->data_vault)
+ goto out_free;
bin_attr_data_vault.private = priv->data_vault;
bin_attr_data_vault.size = obj->package.elements[0].buffer.length;
+out_free:
kfree(buffer.pointer);
}
--
2.26.2
next prev parent reply other threads:[~2022-03-24 19:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 19:09 [PATCH 0/3] thermal: int340x: Misc acpi_buffer handling updates Davidlohr Bueso
2022-03-24 19:09 ` [PATCH 1/3] thermal: int340x: Fix bogus acpi_buffer pointer freeing Davidlohr Bueso
2022-03-25 12:25 ` srinivas pandruvada
2022-04-05 18:27 ` Rafael J. Wysocki
2022-03-24 19:09 ` Davidlohr Bueso [this message]
2022-03-24 19:09 ` [PATCH 3/3] thermal: int340x: Cleanup osc context init Davidlohr Bueso
2022-03-25 2:15 ` [PATCH 0/3] thermal: int340x: Misc acpi_buffer handling updates Zhang Rui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220324190950.70486-3-dave@stgolabs.net \
--to=dave@stgolabs.net \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).