Re: [PATCH 4.19 62/78] can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> From: Dongliang Mu <dzm91@xxxxxxxxxxx>
> 
> [ Upstream commit 3e5b3418827cefb5e1cc658806f02965791b8f07 ]
> 
> The commit 1149108e2fbf ("can: mscan: improve clock API use") only
> adds put_clock() in mpc5xxx_can_remove() function, forgetting to add
> put_clock() in the error handling code.
> 
> Fix this bug by adding put_clock() in the error handling code.

I believe this is wrong.

> Fixes: 1149108e2fbf ("can: mscan: improve clock API use")
> Signed-off-by: Dongliang Mu <dzm91@xxxxxxxxxxx>
> Link: https://lore.kernel.org/all/20221024133828.35881-1-mkl@xxxxxxxxxxxxxx
> Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> ---
>  drivers/net/can/mscan/mpc5xxx_can.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
> index 2949a381a94d..21993ba7ae2a 100644
> --- a/drivers/net/can/mscan/mpc5xxx_can.c
> +++ b/drivers/net/can/mscan/mpc5xxx_can.c
> @@ -336,14 +336,14 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
>  					       &mscan_clksrc);
>  	if (!priv->can.clock.freq) {
>  		dev_err(&ofdev->dev, "couldn't get MSCAN clock properties\n");
> -		goto exit_free_mscan;
> +		goto exit_put_clock;
>  	}

In this case, get_clock() failed and usage count was not
incremented. Yet we do put_clock(), which will lead to problems.

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux