linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart
@ 2020-04-21 12:31 Zou Wei
  2020-04-23 15:46 ` Florian Fainelli
  2020-04-27  6:19 ` Jiri Slaby
  0 siblings, 2 replies; 6+ messages in thread
From: Zou Wei @ 2020-04-21 12:31 UTC (permalink / raw)
  To: gregkh, jslaby, f.fainelli, bcm-kernel-feedback-list,
	linux-serial, linux-arm-kernel, linux-kernel
  Cc: Zou Wei

This patch fixes below error reported by coccicheck

drivers/tty/serial/bcm63xx_uart.c:848:2-8: ERROR: missing clk_put;
clk_get on line 842 and execution via conditional on line 846

Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 drivers/tty/serial/bcm63xx_uart.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index 5674da2..ed0aa5c 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -843,8 +843,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
 	if (IS_ERR(clk) && pdev->dev.of_node)
 		clk = of_clk_get(pdev->dev.of_node, 0);
 
-	if (IS_ERR(clk))
+	if (IS_ERR(clk)) {
+		clk_put(clk);
 		return -ENODEV;
+	}
 
 	port->iotype = UPIO_MEM;
 	port->irq = res_irq->start;
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart
  2020-04-21 12:31 [PATCH -next] tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart Zou Wei
@ 2020-04-23 15:46 ` Florian Fainelli
  2020-04-27  6:19 ` Jiri Slaby
  1 sibling, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2020-04-23 15:46 UTC (permalink / raw)
  To: Zou Wei, gregkh, jslaby, f.fainelli, bcm-kernel-feedback-list,
	linux-serial, linux-arm-kernel, linux-kernel



On 4/21/2020 5:31 AM, Zou Wei wrote:
> This patch fixes below error reported by coccicheck
> 
> drivers/tty/serial/bcm63xx_uart.c:848:2-8: ERROR: missing clk_put;
> clk_get on line 842 and execution via conditional on line 846
> 
> Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")

The driver was doing that prior to being moved, and since this is an 
error path, I am not sure the Fixes tag is really warranted.

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart
  2020-04-21 12:31 [PATCH -next] tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart Zou Wei
  2020-04-23 15:46 ` Florian Fainelli
@ 2020-04-27  6:19 ` Jiri Slaby
  2020-04-27 17:29   ` Florian Fainelli
  1 sibling, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2020-04-27  6:19 UTC (permalink / raw)
  To: Zou Wei, gregkh, f.fainelli, bcm-kernel-feedback-list,
	linux-serial, linux-arm-kernel, linux-kernel

On 21. 04. 20, 14:31, Zou Wei wrote:
> This patch fixes below error reported by coccicheck
> 
> drivers/tty/serial/bcm63xx_uart.c:848:2-8: ERROR: missing clk_put;
> clk_get on line 842 and execution via conditional on line 846
> 
> Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>
> ---
>  drivers/tty/serial/bcm63xx_uart.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
> index 5674da2..ed0aa5c 100644
> --- a/drivers/tty/serial/bcm63xx_uart.c
> +++ b/drivers/tty/serial/bcm63xx_uart.c
> @@ -843,8 +843,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
>  	if (IS_ERR(clk) && pdev->dev.of_node)
>  		clk = of_clk_get(pdev->dev.of_node, 0);
>  
> -	if (IS_ERR(clk))
> +	if (IS_ERR(clk)) {
> +		clk_put(clk);

Why would you want to put an erroneous clk?

>  		return -ENODEV;
> +	}
>  
>  	port->iotype = UPIO_MEM;
>  	port->irq = res_irq->start;
> 


-- 
js
suse labs

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart
  2020-04-27  6:19 ` Jiri Slaby
@ 2020-04-27 17:29   ` Florian Fainelli
  2020-04-28 11:18     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2020-04-27 17:29 UTC (permalink / raw)
  To: Jiri Slaby, Zou Wei, gregkh, bcm-kernel-feedback-list,
	linux-serial, linux-arm-kernel, linux-kernel



On 4/26/2020 11:19 PM, Jiri Slaby wrote:
> On 21. 04. 20, 14:31, Zou Wei wrote:
>> This patch fixes below error reported by coccicheck
>>
>> drivers/tty/serial/bcm63xx_uart.c:848:2-8: ERROR: missing clk_put;
>> clk_get on line 842 and execution via conditional on line 846
>>
>> Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Zou Wei <zou_wei@huawei.com>
>> ---
>>  drivers/tty/serial/bcm63xx_uart.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
>> index 5674da2..ed0aa5c 100644
>> --- a/drivers/tty/serial/bcm63xx_uart.c
>> +++ b/drivers/tty/serial/bcm63xx_uart.c
>> @@ -843,8 +843,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
>>  	if (IS_ERR(clk) && pdev->dev.of_node)
>>  		clk = of_clk_get(pdev->dev.of_node, 0);
>>  
>> -	if (IS_ERR(clk))
>> +	if (IS_ERR(clk)) {
>> +		clk_put(clk);
> 
> Why would you want to put an erroneous clk?

Doh, somehow I completely missed, you are right this does not look legit.
-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart
  2020-04-27 17:29   ` Florian Fainelli
@ 2020-04-28 11:18     ` Greg KH
  2020-05-01  1:40       ` Florian Fainelli
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2020-04-28 11:18 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Jiri Slaby, Zou Wei, bcm-kernel-feedback-list, linux-serial,
	linux-arm-kernel, linux-kernel

On Mon, Apr 27, 2020 at 10:29:58AM -0700, Florian Fainelli wrote:
> 
> 
> On 4/26/2020 11:19 PM, Jiri Slaby wrote:
> > On 21. 04. 20, 14:31, Zou Wei wrote:
> >> This patch fixes below error reported by coccicheck
> >>
> >> drivers/tty/serial/bcm63xx_uart.c:848:2-8: ERROR: missing clk_put;
> >> clk_get on line 842 and execution via conditional on line 846
> >>
> >> Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
> >> Reported-by: Hulk Robot <hulkci@huawei.com>
> >> Signed-off-by: Zou Wei <zou_wei@huawei.com>
> >> ---
> >>  drivers/tty/serial/bcm63xx_uart.c | 4 +++-
> >>  1 file changed, 3 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
> >> index 5674da2..ed0aa5c 100644
> >> --- a/drivers/tty/serial/bcm63xx_uart.c
> >> +++ b/drivers/tty/serial/bcm63xx_uart.c
> >> @@ -843,8 +843,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
> >>  	if (IS_ERR(clk) && pdev->dev.of_node)
> >>  		clk = of_clk_get(pdev->dev.of_node, 0);
> >>  
> >> -	if (IS_ERR(clk))
> >> +	if (IS_ERR(clk)) {
> >> +		clk_put(clk);
> > 
> > Why would you want to put an erroneous clk?
> 
> Doh, somehow I completely missed, you are right this does not look legit.

Ugh, can you send a revert for this please?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart
  2020-04-28 11:18     ` Greg KH
@ 2020-05-01  1:40       ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2020-05-01  1:40 UTC (permalink / raw)
  To: Greg KH, Florian Fainelli
  Cc: Jiri Slaby, Zou Wei, bcm-kernel-feedback-list, linux-serial,
	linux-arm-kernel, linux-kernel



On 4/28/2020 4:18 AM, Greg KH wrote:
> On Mon, Apr 27, 2020 at 10:29:58AM -0700, Florian Fainelli wrote:
>>
>>
>> On 4/26/2020 11:19 PM, Jiri Slaby wrote:
>>> On 21. 04. 20, 14:31, Zou Wei wrote:
>>>> This patch fixes below error reported by coccicheck
>>>>
>>>> drivers/tty/serial/bcm63xx_uart.c:848:2-8: ERROR: missing clk_put;
>>>> clk_get on line 842 and execution via conditional on line 846
>>>>
>>>> Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
>>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>>> Signed-off-by: Zou Wei <zou_wei@huawei.com>
>>>> ---
>>>>  drivers/tty/serial/bcm63xx_uart.c | 4 +++-
>>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
>>>> index 5674da2..ed0aa5c 100644
>>>> --- a/drivers/tty/serial/bcm63xx_uart.c
>>>> +++ b/drivers/tty/serial/bcm63xx_uart.c
>>>> @@ -843,8 +843,10 @@ static int bcm_uart_probe(struct platform_device *pdev)
>>>>  	if (IS_ERR(clk) && pdev->dev.of_node)
>>>>  		clk = of_clk_get(pdev->dev.of_node, 0);
>>>>  
>>>> -	if (IS_ERR(clk))
>>>> +	if (IS_ERR(clk)) {
>>>> +		clk_put(clk);
>>>
>>> Why would you want to put an erroneous clk?
>>
>> Doh, somehow I completely missed, you are right this does not look legit.
> 
> Ugh, can you send a revert for this please?

Yes, now done:

https://lore.kernel.org/linux-arm-kernel/20200501013904.1394-1-f.fainelli@gmail.com/
-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-01  1:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 12:31 [PATCH -next] tty: serial: bcm63xx: fix missing clk_put() in bcm63xx_uart Zou Wei
2020-04-23 15:46 ` Florian Fainelli
2020-04-27  6:19 ` Jiri Slaby
2020-04-27 17:29   ` Florian Fainelli
2020-04-28 11:18     ` Greg KH
2020-05-01  1:40       ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).