diff mbox series

[v2] iio: adc: pac1921: Move ACPI_FREE to cover all branches

Message ID 20250115130347.10777-1-victor.duicu@microchip.com (mailing list archive)
State New
Headers show
Series [v2] iio: adc: pac1921: Move ACPI_FREE to cover all branches | expand

Commit Message

victor.duicu@microchip.com Jan. 15, 2025, 1:03 p.m. UTC
From: Victor Duicu <victor.duicu@microchip.com>

This patch moves ACPI_FREE in pac1921_match_acpi_device
in order to cover all branches.

Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Fixes: 9fdf1d033316 ("iio: adc: pac1921: Add ACPI support to Microchip pac1921")
Signed-off-by: Victor Duicu <victor.duicu@microchip.com>
---

This patch ensures that status is freed before
exiting the function.

Differences related to previous versions:
v2:
- add Fixes tag.
- remove unnecessary blank line.

v1:
- initial version for review.

 drivers/iio/adc/pac1921.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 577a66e2e634f712384c57a98f504c44ea4b47da
diff mbox series

Patch

diff --git a/drivers/iio/adc/pac1921.c b/drivers/iio/adc/pac1921.c
index 90f61c47b1c4..63f518215156 100644
--- a/drivers/iio/adc/pac1921.c
+++ b/drivers/iio/adc/pac1921.c
@@ -1198,11 +1198,11 @@  static int pac1921_match_acpi_device(struct iio_dev *indio_dev)
 
 	label = devm_kstrdup(dev, status->package.elements[0].string.pointer,
 			     GFP_KERNEL);
+	ACPI_FREE(status);
 	if (!label)
 		return -ENOMEM;
 
 	indio_dev->label = label;
-	ACPI_FREE(status);
 
 	return 0;
 }