diff mbox series

[RESEND] soc: amlogic: add missing of_node_put()

Message ID HK0PR02MB3634BF379E6F17F7FC82906BB26C0@HK0PR02MB3634.apcprd02.prod.outlook.com (mailing list archive)
State Superseded
Headers show
Series [RESEND] soc: amlogic: add missing of_node_put() | expand

Commit Message

Wen Yang Feb. 3, 2019, 5:41 a.m. UTC
The call to of_parse_phandle returns a node pointer with refcount
incremented thus it must be explicitly decremented here after the last
usage.

Signed-off-by: Wen Yang <yellowriver2010@hotmail.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-amlogic@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/soc/amlogic/meson-canvas.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Neil Armstrong Feb. 4, 2019, 9:30 a.m. UTC | #1
Hi,

On 03/02/2019 06:41, wen yang wrote:
> The call to of_parse_phandle returns a node pointer with refcount
> incremented thus it must be explicitly decremented here after the last
> usage.
> 

Missing a Fixes tag.

> Signed-off-by: Wen Yang <yellowriver2010@hotmail.com>
> Cc: Kevin Hilman <khilman@baylibre.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-amlogic@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/soc/amlogic/meson-canvas.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c
> index fce33ca..87a6c6e 100644
> --- a/drivers/soc/amlogic/meson-canvas.c
> +++ b/drivers/soc/amlogic/meson-canvas.c
> @@ -57,9 +57,12 @@ struct meson_canvas *meson_canvas_get(struct device *dev)
>  		return ERR_PTR(-ENODEV);
>  
>  	canvas_pdev = of_find_device_by_node(canvas_node);
> -	if (!canvas_pdev)
> +	if (!canvas_pdev) {
> +		of_node_put(canvas_node);
>  		return ERR_PTR(-EPROBE_DEFER);
> +	}
>  
> +	of_node_put(canvas_node);
>  	return dev_get_drvdata(&canvas_pdev->dev);
>  }
>  EXPORT_SYMBOL_GPL(meson_canvas_get);
> 

Apart the missing Fixes tag :

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

Neil
diff mbox series

Patch

diff --git a/drivers/soc/amlogic/meson-canvas.c b/drivers/soc/amlogic/meson-canvas.c
index fce33ca..87a6c6e 100644
--- a/drivers/soc/amlogic/meson-canvas.c
+++ b/drivers/soc/amlogic/meson-canvas.c
@@ -57,9 +57,12 @@  struct meson_canvas *meson_canvas_get(struct device *dev)
 		return ERR_PTR(-ENODEV);
 
 	canvas_pdev = of_find_device_by_node(canvas_node);
-	if (!canvas_pdev)
+	if (!canvas_pdev) {
+		of_node_put(canvas_node);
 		return ERR_PTR(-EPROBE_DEFER);
+	}
 
+	of_node_put(canvas_node);
 	return dev_get_drvdata(&canvas_pdev->dev);
 }
 EXPORT_SYMBOL_GPL(meson_canvas_get);