diff mbox series

squash! i2c: max9286: Put of node on error

Message ID 20200409170806.1842811-1-jacopo+renesas@jmondi.org (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series squash! i2c: max9286: Put of node on error | expand

Commit Message

Jacopo Mondi April 9, 2020, 5:08 p.m. UTC
Put the device of node in case of dt parsing error.

Fixes: 9eed4185c7a0 ("media: i2c: Add MAX9286 driver")
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/max9286.c | 4 ++++
 1 file changed, 4 insertions(+)

--
2.26.0

Comments

Jacopo Mondi April 9, 2020, 8:20 p.m. UTC | #1
Dunno why, I formatted the patch in a way others interested parties
have been removed from the Cc list, just noticed :/

It's such a minor fix I won't bother resending I think

On Thu, Apr 09, 2020 at 07:08:06PM +0200, Jacopo Mondi wrote:
> Put the device of node in case of dt parsing error.
>
> Fixes: 9eed4185c7a0 ("media: i2c: Add MAX9286 driver")

Also this is a leftover from where this was intended to be sent out a
patch on it's own

> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  drivers/media/i2c/max9286.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
> index 241deed0f270..bac9696f83b4 100644
> --- a/drivers/media/i2c/max9286.c
> +++ b/drivers/media/i2c/max9286.c
> @@ -1121,6 +1121,7 @@ static int max9286_parse_dt(struct max9286_priv *priv)
>  	i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux");
>  	if (!i2c_mux) {
>  		dev_err(dev, "Failed to find i2c-mux node\n");
> +		of_node_put(dev->of_node);
>  		return -EINVAL;
>  	}
>
> @@ -1168,6 +1169,7 @@ static int max9286_parse_dt(struct max9286_priv *priv)
>  					of_fwnode_handle(node), &vep);
>  			if (ret) {
>  				of_node_put(node);
> +				of_node_put(dev->of_node);
>  				return ret;
>  			}
>
> @@ -1177,6 +1179,7 @@ static int max9286_parse_dt(struct max9286_priv *priv)
>  					vep.bus_type);
>  				v4l2_fwnode_endpoint_free(&vep);
>  				of_node_put(node);
> +				of_node_put(dev->of_node);
>  				return -EINVAL;
>  			}
>
> @@ -1214,6 +1217,7 @@ static int max9286_parse_dt(struct max9286_priv *priv)
>  		priv->nsources++;
>  	}
>  	of_node_put(node);
> +	of_node_put(dev->of_node);
>
>  	priv->route_mask = priv->source_mask;
>
> --
> 2.26.0
>
Kieran Bingham April 10, 2020, 7:20 a.m. UTC | #2
On 09/04/2020 21:20, Jacopo Mondi wrote:
> Dunno why, I formatted the patch in a way others interested parties
> have been removed from the Cc list, just noticed :/
> 
> It's such a minor fix I won't bother resending I think
> 
> On Thu, Apr 09, 2020 at 07:08:06PM +0200, Jacopo Mondi wrote:
>> Put the device of node in case of dt parsing error.
>>
>> Fixes: 9eed4185c7a0 ("media: i2c: Add MAX9286 driver")
> 
> Also this is a leftover from where this was intended to be sent out a
> patch on it's own
> 

Added to my branch, so it will be included in the next squash.

Thanks.

--
Kieran


>> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
>> ---
>>  drivers/media/i2c/max9286.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
>> index 241deed0f270..bac9696f83b4 100644
>> --- a/drivers/media/i2c/max9286.c
>> +++ b/drivers/media/i2c/max9286.c
>> @@ -1121,6 +1121,7 @@ static int max9286_parse_dt(struct max9286_priv *priv)
>>  	i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux");
>>  	if (!i2c_mux) {
>>  		dev_err(dev, "Failed to find i2c-mux node\n");
>> +		of_node_put(dev->of_node);
>>  		return -EINVAL;
>>  	}
>>
>> @@ -1168,6 +1169,7 @@ static int max9286_parse_dt(struct max9286_priv *priv)
>>  					of_fwnode_handle(node), &vep);
>>  			if (ret) {
>>  				of_node_put(node);
>> +				of_node_put(dev->of_node);
>>  				return ret;
>>  			}
>>
>> @@ -1177,6 +1179,7 @@ static int max9286_parse_dt(struct max9286_priv *priv)
>>  					vep.bus_type);
>>  				v4l2_fwnode_endpoint_free(&vep);
>>  				of_node_put(node);
>> +				of_node_put(dev->of_node);
>>  				return -EINVAL;
>>  			}
>>
>> @@ -1214,6 +1217,7 @@ static int max9286_parse_dt(struct max9286_priv *priv)
>>  		priv->nsources++;
>>  	}
>>  	of_node_put(node);
>> +	of_node_put(dev->of_node);
>>
>>  	priv->route_mask = priv->source_mask;
>>
>> --
>> 2.26.0
>>
diff mbox series

Patch

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 241deed0f270..bac9696f83b4 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -1121,6 +1121,7 @@  static int max9286_parse_dt(struct max9286_priv *priv)
 	i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux");
 	if (!i2c_mux) {
 		dev_err(dev, "Failed to find i2c-mux node\n");
+		of_node_put(dev->of_node);
 		return -EINVAL;
 	}

@@ -1168,6 +1169,7 @@  static int max9286_parse_dt(struct max9286_priv *priv)
 					of_fwnode_handle(node), &vep);
 			if (ret) {
 				of_node_put(node);
+				of_node_put(dev->of_node);
 				return ret;
 			}

@@ -1177,6 +1179,7 @@  static int max9286_parse_dt(struct max9286_priv *priv)
 					vep.bus_type);
 				v4l2_fwnode_endpoint_free(&vep);
 				of_node_put(node);
+				of_node_put(dev->of_node);
 				return -EINVAL;
 			}

@@ -1214,6 +1217,7 @@  static int max9286_parse_dt(struct max9286_priv *priv)
 		priv->nsources++;
 	}
 	of_node_put(node);
+	of_node_put(dev->of_node);

 	priv->route_mask = priv->source_mask;