[PATCH] serial: 8250_bcm2835aux: return PTR_ERR when fail to acquire clk

Zeng Heng zengheng4 at huawei.com
Sat Oct 22 23:50:53 PDT 2022


Add error handling process when fail to acquire clk by
`devm_clk_get_optional`.

Signed-off-by: Zeng Heng <zengheng4 at huawei.com>
---
 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..1c623e93232c 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 PTR_ERR(data->clk);
 
 	/* get the interrupt */
 	ret = platform_get_irq(pdev, 0);
-- 
2.25.1




More information about the linux-arm-kernel mailing list