[v1] slimbus: core: Fix mismatch in of_node_get/put
diff mbox series

Message ID 20200326173457.29233-1-saravanak@google.com
State In Next
Commit 184fc1bf27832ee736d5ade5c2e11005fa50b573
Headers show
Series
  • [v1] slimbus: core: Fix mismatch in of_node_get/put
Related show

Commit Message

Saravana Kannan March 26, 2020, 5:34 p.m. UTC
Also, remove some unnecessary NULL checks. The functions in question
already do NULL checks.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/slimbus/core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Srinivas Kandagatla April 17, 2020, 9:35 a.m. UTC | #1
On 26/03/2020 17:34, Saravana Kannan wrote:
> Also, remove some unnecessary NULL checks. The functions in question
> already do NULL checks.
> 
> Signed-off-by: Saravana Kannan <saravanak@google.com>

Applied Thanks,
--srini

> ---
>   drivers/slimbus/core.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
> index 44228a5b246d..ae1e248a8fb8 100644
> --- a/drivers/slimbus/core.c
> +++ b/drivers/slimbus/core.c
> @@ -162,11 +162,8 @@ static int slim_add_device(struct slim_controller *ctrl,
>   	sbdev->ctrl = ctrl;
>   	INIT_LIST_HEAD(&sbdev->stream_list);
>   	spin_lock_init(&sbdev->stream_list_lock);
> -
> -	if (node) {
> -		sbdev->dev.of_node = of_node_get(node);
> -		sbdev->dev.fwnode = of_fwnode_handle(node);
> -	}
> +	sbdev->dev.of_node = of_node_get(node);
> +	sbdev->dev.fwnode = of_fwnode_handle(node);
>   
>   	dev_set_name(&sbdev->dev, "%x:%x:%x:%x",
>   				  sbdev->e_addr.manf_id,
> @@ -285,6 +282,7 @@ EXPORT_SYMBOL_GPL(slim_register_controller);
>   /* slim_remove_device: Remove the effect of slim_add_device() */
>   static void slim_remove_device(struct slim_device *sbdev)
>   {
> +	of_node_put(sbdev->dev.of_node);
>   	device_unregister(&sbdev->dev);
>   }
>   
>

Patch
diff mbox series

diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index 44228a5b246d..ae1e248a8fb8 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -162,11 +162,8 @@  static int slim_add_device(struct slim_controller *ctrl,
 	sbdev->ctrl = ctrl;
 	INIT_LIST_HEAD(&sbdev->stream_list);
 	spin_lock_init(&sbdev->stream_list_lock);
-
-	if (node) {
-		sbdev->dev.of_node = of_node_get(node);
-		sbdev->dev.fwnode = of_fwnode_handle(node);
-	}
+	sbdev->dev.of_node = of_node_get(node);
+	sbdev->dev.fwnode = of_fwnode_handle(node);
 
 	dev_set_name(&sbdev->dev, "%x:%x:%x:%x",
 				  sbdev->e_addr.manf_id,
@@ -285,6 +282,7 @@  EXPORT_SYMBOL_GPL(slim_register_controller);
 /* slim_remove_device: Remove the effect of slim_add_device() */
 static void slim_remove_device(struct slim_device *sbdev)
 {
+	of_node_put(sbdev->dev.of_node);
 	device_unregister(&sbdev->dev);
 }