[PATCH 1/1] serial: ns16550: move iomem/ioport init after clock init

Maxim Kochetkov fido_max at inbox.ru
Thu Feb 16 23:31:57 PST 2023


While probing ns16550 clock provider may be unavailable and
clk_get() returns -EPROBE_DEFER. Next ns16550_probe() attempts
will be failed too because of dev_request_mem_resource() has already
acquired this resource for the device and returns -EBUSY.
So move resource allocation just after clock init. It will let proper
probe for defered clocks.

Signed-off-by: Maxim Kochetkov <fido_max at inbox.ru>
Signed-off-by: Maxim Kochetkov <m.kochetkov at yadro.com>
---
 drivers/serial/serial_ns16550.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 16f3576645..6eeb67ca81 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -479,10 +479,6 @@ static int ns16550_probe(struct device *dev)
 
 	priv = xzalloc(sizeof(*priv));
 
-	ret = ns16550_init_iomem(dev, priv);
-	if (ret)
-		ret = ns16550_init_ioport(dev, priv);
-
 	if (ret)
 		return ret;
 
@@ -511,6 +507,10 @@ static int ns16550_probe(struct device *dev)
 		goto err;
 	}
 
+	ret = ns16550_init_iomem(dev, priv);
+	if (ret)
+		ret = ns16550_init_ioport(dev, priv);
+
 	cdev = &priv->cdev;
 	cdev->dev = dev;
 	cdev->tstc = ns16550_tstc;
-- 
2.38.1




More information about the barebox mailing list