summaryrefslogtreecommitdiff
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-10-04 15:26:36 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2022-10-04 17:08:50 +0300
commit800b8eecb284eb0f1d213dae5d00b4f372b7353a (patch)
tree389431b90118f2e02c97e485444565b322e4a21e /drivers/platform/x86
parent9388076b4cedf199624173b4fcd3f208c02632d6 (diff)
downloadlinux-800b8eecb284eb0f1d213dae5d00b4f372b7353a.tar.xz
platform/x86: int3472: Don't leak reference on error
The for_each_acpi_consumer_dev() takes a reference to the iterator and if we break a loop we must drop that reference. This usually happens when error handling is involved. However it's not the case for skl_int3472_fill_clk_pdata(). Don't leak reference on error by dropping it properly. Fixes: 43cf36974d76 ("platform/x86: int3472: Support multiple clock consumers") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/intel/int3472/tps68470.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
index 49fc379fe680..62093fde187f 100644
--- a/drivers/platform/x86/intel/int3472/tps68470.c
+++ b/drivers/platform/x86/intel/int3472/tps68470.c
@@ -128,15 +128,15 @@ skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data
for_each_acpi_consumer_dev(adev, consumer) {
sensor_name = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT,
acpi_dev_name(consumer));
- if (!sensor_name)
+ if (!sensor_name) {
+ acpi_dev_put(consumer);
return -ENOMEM;
+ }
(*clk_pdata)->consumers[i].consumer_dev_name = sensor_name;
i++;
}
- acpi_dev_put(consumer);
-
return n_consumers;
}