diff mbox

[1/5] drivers/iio: am335x_adc: cleanup on missing DT nodes

Message ID 1369847397-27451-2-git-send-email-bigeasy@linutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Sebastian Andrzej Siewior May 29, 2013, 5:09 p.m. UTC
Currently we leak indio_dev() if the DT has no "adc" node in it.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/iio/adc/ti_am335x_adc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jonathan Cameron June 2, 2013, 5:56 p.m. UTC | #1
On 05/29/2013 06:09 PM, Sebastian Andrzej Siewior wrote:
> Currently we leak indio_dev() if the DT has no "adc" node in it.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Given you are going to end up rerolling the original series
(and it hasn't been taken by anyone yet) this wants to go
in a new version of that not as a separate patch.
> ---
>  drivers/iio/adc/ti_am335x_adc.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> index d0317fc..b2f27de 100644
> --- a/drivers/iio/adc/ti_am335x_adc.c
> +++ b/drivers/iio/adc/ti_am335x_adc.c
> @@ -208,8 +208,10 @@ static int tiadc_probe(struct platform_device *pdev)
>  	adc_dev->mfd_tscadc = tscadc_dev;
>  
>  	node = of_get_child_by_name(node, "adc");
> -	if (!node)
> -		return  -EINVAL;
> +	if (!node) {
> +		err = -EINVAL;
> +		goto err_free_device;
> +	}
>  	err = of_property_read_u32(node,
>  			"ti,adc-channels", &val32);
>  	if (err < 0)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sebastian Andrzej Siewior June 4, 2013, 10:38 a.m. UTC | #2
* Jonathan Cameron | 2013-06-02 18:56:40 [+0100]:

>On 05/29/2013 06:09 PM, Sebastian Andrzej Siewior wrote:
>> Currently we leak indio_dev() if the DT has no "adc" node in it.
>> 
>> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>Given you are going to end up rerolling the original series
>(and it hasn't been taken by anyone yet) this wants to go
>in a new version of that not as a separate patch.

Yes, why not.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index d0317fc..b2f27de 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -208,8 +208,10 @@  static int tiadc_probe(struct platform_device *pdev)
 	adc_dev->mfd_tscadc = tscadc_dev;
 
 	node = of_get_child_by_name(node, "adc");
-	if (!node)
-		return  -EINVAL;
+	if (!node) {
+		err = -EINVAL;
+		goto err_free_device;
+	}
 	err = of_property_read_u32(node,
 			"ti,adc-channels", &val32);
 	if (err < 0)