drivers/tty/serial: Add missing clk_disable_unprepare()
Subsystems (3)
PATCH 1/1 drivers/tty/serial: Add missing clk_disable_unprepare()
Add missing clk_disable_unprepare() when get clk rate fails.
--- drivers/tty/serial/8250/8250_bcm2835aux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_bcm2835aux.c +4 -2
@@ -166,8 +166,10 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev) uartclk =clk_get_rate (data->clk);if (!uartclk) { ret =device_property_read_u32 (&pdev->dev,"clock-frequency" , &uartclk); -if (ret) -return dev_err_probe (&pdev->dev, ret,"could not get clk rate\n" ); +if (ret) { +dev_err_probe (&pdev->dev, ret,"could not get clk rate\n" ); + goto dis_clk; + } }/* the HW-clock divider for bcm2835aux is 8,
Signature · 1 line
2.17.1
Greg KH
maintainerQuoted 3 lines · Guo Mengqi
Add missing
clk_disable_unprepare()when get clk rate fails.Reported-by Hulk Robot <[email protected]>
How did the robot report it?
How was this tested?
You have read the documentation for how to correctly report problems found and fixed by automated tools, right? Please update the changelog to include all of that information.
thanks,
greg k-h
PATCH v2 1/1 serial: 8250_bcm2835aux: Add missing clk_disable_unprepare()
In reply to Guo MengqiThe error path when get clock frequency fails in bcm2835aux_serial driver does not correctly disable the clock.
This flaw was found using a static analysis tool "Hulk Robot", which reported the following warning when analyzing linux-next/master:
drivers/tty/serial/8250/8250_bcm2835aux.c:
warning: clk_disable_unprepare_missing.cocciThe cocci script checks for the existence of clk_disable_unprepare() paired with clk_prepare_enable().
Add the missing clk_disable_unprepare() to the error path.
---
v2:
- Change title to more standard format
- Add details about how Hulk Robot report this issue.
--- drivers/tty/serial/8250/8250_bcm2835aux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_bcm2835aux.c +4 -2
@@ -167,8 +167,10 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev) uartclk =clk_get_rate (data->clk);if (!uartclk) { ret =device_property_read_u32 (&pdev->dev,"clock-frequency" , &uartclk); -if (ret) -return dev_err_probe (&pdev->dev, ret,"could not get clk rate\n" ); +if (ret) { +dev_err_probe (&pdev->dev, ret,"could not get clk rate\n" ); + goto dis_clk; + } }/* the HW-clock divider for bcm2835aux is 8,
Signature · 1 line
2.17.1
Quoted 4 lines · Guo Mengqi' via BCM-KERNEL-FEEDBACK-LIST,PDL
Add missing
clk_disable_unprepare()when get clk rate fails.Reported-by Hulk Robot <[email protected]>Signed-off-by Guo Mengqi <[email protected]>
Looks about right, can we use the same prefix as the majority of other changes:
serial: 8250_bcm2835aux: Add missing clk_disable_unprepare()
and slap a:
Thanks!
Quoted 21 lines
--- drivers/tty/serial/8250/8250_bcm2835aux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/tty/serial/8250/8250_bcm2835aux.c +4
-2@@ -166,8 +166,10 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev) uartclk =clk_get_rate (data->clk);if (!uartclk) { ret =device_property_read_u32 (&pdev->dev,"clock-frequency" , &uartclk); -if (ret) -return dev_err_probe (&pdev->dev, ret,"could not get clk rate\n" ); +if (ret) { +dev_err_probe (&pdev->dev, ret,"could not get clk rate\n" ); + goto dis_clk; + } }/* the HW-clock divider for bcm2835aux is 8,
Signature · 1 line
Florian
Hi Florian,
Yes I found it's better to use title of same style. I did not pay attention to this.
I will send a new version of this patch.
Thank you!
Quoted 41 lines · Florian Fainelli
Quoted 4 lines · Guo Mengqi' via BCM-KERNEL-FEEDBACK-LIST,PDL
Add missing
clk_disable_unprepare()when get clk rate fails.Reported-by Hulk Robot <[email protected]>Signed-off-by Guo Mengqi <[email protected]>Looks about right, can we use the same prefix as the majority of other changes:
serial: 8250_bcm2835aux: Add missing
clk_disable_unprepare()and slap a:
Fixes fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")Thanks!
Quoted 22 lines
---
drivers/tty/serial/8250/8250_bcm2835aux.c| 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)drivers/tty/serial/8250/8250_bcm2835aux.c +4
-2@@ -166,8 +166,10 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev) uartclk = clk_get_rate(data->clk); if (!uartclk) { ret = device_property_read_u32(&pdev->dev, "clock-frequency", &uartclk); - if (ret) - return dev_err_probe(&pdev->dev, ret, "could not get clk rate\n"); + if (ret) { + dev_err_probe(&pdev->dev, ret, "could not get clk rate\n"); + goto dis_clk; + } }/* the HW-clock divider for bcm2835aux is 8,
PATCH v3 1/1 serial: 8250_bcm2835aux: Add missing clk_disable_unprepare()
The error path when get clock frequency fails in bcm2835aux_serial driver does not correctly disable the clock.
This flaw was found using a static analysis tool "Hulk Robot", which reported the following warning when analyzing linux-next/master:
drivers/tty/serial/8250/8250_bcm2835aux.c:
warning: clk_disable_unprepare_missing.cocciThe cocci script checks for the existence of clk_disable_unprepare() paired with clk_prepare_enable().
Add the missing clk_disable_unprepare() to the error path.
---
v2:
- Change title to more standard format
- Add details about how Hulk Robot report this issue. v3:
- add which commit this patch fixes
--- drivers/tty/serial/8250/8250_bcm2835aux.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_bcm2835aux.c +4 -2
@@ -167,8 +167,10 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev) uartclk =clk_get_rate (data->clk);if (!uartclk) { ret =device_property_read_u32 (&pdev->dev,"clock-frequency" , &uartclk); -if (ret) -return dev_err_probe (&pdev->dev, ret,"could not get clk rate\n" ); +if (ret) { +dev_err_probe (&pdev->dev, ret,"could not get clk rate\n" ); + goto dis_clk; + } }/* the HW-clock divider for bcm2835aux is 8,
Signature · 1 line
2.17.1
Re: [PATCH -next v3] serial: 8250_bcm2835aux: Add missing clk_disable_unprepare()
Quoted 9 lines · Guo Mengqi
The error path when get clock frequency fails in
bcm2835aux_serialdriver does not correctly disable the clock.This flaw was found using a static analysis tool "Hulk Robot", which reported the following warning when analyzing linux-next/master:
drivers/tty/serial/8250/8250_bcm2835aux.c: warning: clk_disable_unprepare_missing.cocci
Quoted 8 lines
The cocci script checks for the existence of
clk_disable_unprepare()paired withclk_prepare_enable().Add the missing
clk_disable_unprepare()to the error path.Fixes fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")Reported-by Hulk Robot <[email protected]>Signed-off-by Guo Mengqi <[email protected]>
Signature · 1 line
Florian