[PATCH] serial: 8250_bcm2835aux: Restore clock error handling

Stefan Wahren posted 1 patch 2 years ago
drivers/tty/serial/8250/8250_bcm2835aux.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] serial: 8250_bcm2835aux: Restore clock error handling
Posted by Stefan Wahren 2 years ago
The commit fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")
dropped the error handling for clock acquiring. But even an optional
clock needs this.

Fixes: fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/tty/serial/8250/8250_bcm2835aux.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c
index 15a2387a5b25..4f4502fb5454 100644
--- a/drivers/tty/serial/8250/8250_bcm2835aux.c
+++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
@@ -119,6 +119,8 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)

 	/* get the clock - this also enables the HW */
 	data->clk = devm_clk_get_optional(&pdev->dev, NULL);
+	if (IS_ERR(data->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(data->clk), "could not get clk\n");

 	/* get the interrupt */
 	ret = platform_get_irq(pdev, 0);
--
2.34.1
Re: [PATCH] serial: 8250_bcm2835aux: Restore clock error handling
Posted by Jeremy Linton 1 year, 11 months ago
Hi,


On 12/20/23 05:43, Stefan Wahren wrote:
> The commit fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")
> dropped the error handling for clock acquiring. But even an optional
> clock needs this.

Right, the call was changed to _optional() during review but the error 
handling didn't get put back.

> 
> Fixes: fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>   drivers/tty/serial/8250/8250_bcm2835aux.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c
> index 15a2387a5b25..4f4502fb5454 100644
> --- a/drivers/tty/serial/8250/8250_bcm2835aux.c
> +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
> @@ -119,6 +119,8 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
> 
>   	/* get the clock - this also enables the HW */
>   	data->clk = devm_clk_get_optional(&pdev->dev, NULL);
> +	if (IS_ERR(data->clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(data->clk), "could not get clk\n");
> 
>   	/* get the interrupt */
>   	ret = platform_get_irq(pdev, 0);
> --

And on ACPI machines it returns NULL, which passes the error check now, 
so it works on an ACPI based pi.

Thanks!

Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Jeremy Linton <jeremy.linton@arm.com>
Re: [PATCH] serial: 8250_bcm2835aux: Restore clock error handling
Posted by Stefan Wahren 1 year, 11 months ago
Hi Jeremy,

Am 10.01.24 um 01:01 schrieb Jeremy Linton:
> Hi,
>
>
> On 12/20/23 05:43, Stefan Wahren wrote:
>> The commit fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")
>> dropped the error handling for clock acquiring. But even an optional
>> clock needs this.
>
> Right, the call was changed to _optional() during review but the error
> handling didn't get put back.
>
>>
>> Fixes: fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>> ---
>>   drivers/tty/serial/8250/8250_bcm2835aux.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c
>> b/drivers/tty/serial/8250/8250_bcm2835aux.c
>> index 15a2387a5b25..4f4502fb5454 100644
>> --- a/drivers/tty/serial/8250/8250_bcm2835aux.c
>> +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
>> @@ -119,6 +119,8 @@ static int bcm2835aux_serial_probe(struct
>> platform_device *pdev)
>>
>>       /* get the clock - this also enables the HW */
>>       data->clk = devm_clk_get_optional(&pdev->dev, NULL);
>> +    if (IS_ERR(data->clk))
>> +        return dev_err_probe(&pdev->dev, PTR_ERR(data->clk), "could
>> not get clk\n");
>>
>>       /* get the interrupt */
>>       ret = platform_get_irq(pdev, 0);
>> --
>
> And on ACPI machines it returns NULL, which passes the error check
> now, so it works on an ACPI based pi.
>
> Thanks!
>
> Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
> Tested-by: Jeremy Linton <jeremy.linton@arm.com>

thanks for testing. The patch is already in linux-next.

Regards
Re: [PATCH] serial: 8250_bcm2835aux: Restore clock error handling
Posted by Florian Fainelli 1 year, 11 months ago
On 12/20/23 03:43, Stefan Wahren wrote:
> The commit fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")
> dropped the error handling for clock acquiring. But even an optional
> clock needs this.
> 
> Fixes: fcc446c8aa63 ("serial: 8250_bcm2835aux: Add ACPI support")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian