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

victor.duicu@microchip.com posted 1 patch 11 months, 1 week ago
There is a newer version of this series
drivers/iio/adc/pac1921.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v1] iio: adc: pac1921: Move ACPI_FREE to cover all branches
Posted by victor.duicu@microchip.com 11 months, 1 week ago
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>
Signed-off-by: Victor Duicu <victor.duicu@microchip.com>
---
 drivers/iio/adc/pac1921.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

diff --git a/drivers/iio/adc/pac1921.c b/drivers/iio/adc/pac1921.c
index 90f61c47b1c4..6b67e387b3c0 100644
--- a/drivers/iio/adc/pac1921.c
+++ b/drivers/iio/adc/pac1921.c
@@ -1198,11 +1198,12 @@ 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;
 }

base-commit: 577a66e2e634f712384c57a98f504c44ea4b47da
-- 
2.45.2
Re: [PATCH v1] iio: adc: pac1921: Move ACPI_FREE to cover all branches
Posted by Andy Shevchenko 11 months, 1 week ago
On Mon, Jan 13, 2025 at 3:25 PM <victor.duicu@microchip.com> wrote:
>
> From: Victor Duicu <victor.duicu@microchip.com>
>
> This patch moves ACPI_FREE in pac1921_match_acpi_device

ACPI_FREE()
pac1921_match_acpi_device()

> in order to cover all branches.

Do we need a Fixes tag?

...

> +       ACPI_FREE(status);
> +

Not sure if we need this blank line.

>         if (!label)
>                 return -ENOMEM;

...

Other than above, LGTM, thanks for addressing it.

-- 
With Best Regards,
Andy Shevchenko