Skip to content

Commit 800b8ee

Browse files
andy-shevrafaeljw
authored andcommitted
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: 43cf369 ("platform/x86: int3472: Support multiple clock consumers") Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 9388076 commit 800b8ee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/platform/x86/intel/int3472/tps68470.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data
128128
for_each_acpi_consumer_dev(adev, consumer) {
129129
sensor_name = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT,
130130
acpi_dev_name(consumer));
131-
if (!sensor_name)
131+
if (!sensor_name) {
132+
acpi_dev_put(consumer);
132133
return -ENOMEM;
134+
}
133135

134136
(*clk_pdata)->consumers[i].consumer_dev_name = sensor_name;
135137
i++;
136138
}
137139

138-
acpi_dev_put(consumer);
139-
140140
return n_consumers;
141141
}
142142

0 commit comments

Comments
 (0)