diff mbox series

can: m_can: remove redundant check for pm_clock_support

Message ID 20240104235723.46931-1-francesco@dolcini.it (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series can: m_can: remove redundant check for pm_clock_support | expand

Checks

Context Check Description
netdev/tree_selection success Series ignored based on subject

Commit Message

Francesco Dolcini Jan. 4, 2024, 11:57 p.m. UTC
From: Francesco Dolcini <francesco.dolcini@toradex.com>

m_can_clk_start() already skip starting the clock when
clock support is disabled, remove the redundant check in
m_can_class_register().

This also solves the imbalance with m_can_clk_stop() that is called
afterward in the same function before the return.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
I spotted the issue while debugging some other part of the code,
the patch is only compile-tested.
---
 drivers/net/can/m_can/m_can.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Markus Schneider-Pargmann Jan. 15, 2024, 9:52 a.m. UTC | #1
On Fri, Jan 05, 2024 at 12:57:23AM +0100, Francesco Dolcini wrote:
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> m_can_clk_start() already skip starting the clock when
> clock support is disabled, remove the redundant check in
> m_can_class_register().
> 
> This also solves the imbalance with m_can_clk_stop() that is called
> afterward in the same function before the return.
> 
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>

Best,
Markus

> ---
> I spotted the issue while debugging some other part of the code,
> the patch is only compile-tested.
> ---
>  drivers/net/can/m_can/m_can.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index 16ecc11c7f62..bd1d1626684d 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -2056,11 +2056,9 @@ int m_can_class_register(struct m_can_classdev *cdev)
>  {
>  	int ret;
>  
> -	if (cdev->pm_clock_support) {
> -		ret = m_can_clk_start(cdev);
> -		if (ret)
> -			return ret;
> -	}
> +	ret = m_can_clk_start(cdev);
> +	if (ret)
> +		return ret;
>  
>  	if (cdev->is_peripheral) {
>  		ret = can_rx_offload_add_manual(cdev->net, &cdev->offload,
> -- 
> 2.39.2
>
Francesco Dolcini Feb. 16, 2024, 7:45 a.m. UTC | #2
Hello Marc and Vincent,

On Fri, Jan 05, 2024 at 12:57:23AM +0100, Francesco Dolcini wrote:
> From: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> m_can_clk_start() already skip starting the clock when
> clock support is disabled, remove the redundant check in
> m_can_class_register().
> 
> This also solves the imbalance with m_can_clk_stop() that is called
> afterward in the same function before the return.
> 
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>

Did you missed this? Or do you have some concern with it?

Francesco
Marc Kleine-Budde Feb. 16, 2024, 7:56 a.m. UTC | #3
On 16.02.2024 08:45:27, Francesco Dolcini wrote:
> Hello Marc and Vincent,
> 
> On Fri, Jan 05, 2024 at 12:57:23AM +0100, Francesco Dolcini wrote:
> > From: Francesco Dolcini <francesco.dolcini@toradex.com>
> > 
> > m_can_clk_start() already skip starting the clock when
> > clock support is disabled, remove the redundant check in
> > m_can_class_register().
> > 
> > This also solves the imbalance with m_can_clk_stop() that is called
> > afterward in the same function before the return.
> > 
> > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> 
> Did you missed this? Or do you have some concern with it?

Somehow missed it in the last PR, but already part of the next PR.

regards,
Marc
diff mbox series

Patch

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 16ecc11c7f62..bd1d1626684d 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -2056,11 +2056,9 @@  int m_can_class_register(struct m_can_classdev *cdev)
 {
 	int ret;
 
-	if (cdev->pm_clock_support) {
-		ret = m_can_clk_start(cdev);
-		if (ret)
-			return ret;
-	}
+	ret = m_can_clk_start(cdev);
+	if (ret)
+		return ret;
 
 	if (cdev->is_peripheral) {
 		ret = can_rx_offload_add_manual(cdev->net, &cdev->offload,