From: Dan Carpenter <dan.carpenter@linaro.org>
To: Binbin Zhou <zhoubinbin@loongson.cn>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Haowei Zheng <zhenghaowei@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH next] serial: 8250: longson: Fix NULL vs IS_ERR() bug in probe
Date: Sat, 29 Nov 2025 17:51:23 +0300 [thread overview]
Message-ID: <aSsIa3KdAlXh5uQC@stanley.mountain> (raw)
The devm_platform_get_and_ioremap_resource() function never returns
NULL, it returns error pointers. Fix the error checking to match.
Fixes: 25e95d763176 ("serial: 8250: Add Loongson uart driver support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/tty/serial/8250/8250_loongson.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_loongson.c b/drivers/tty/serial/8250/8250_loongson.c
index 53153a116c01..47df3c4c9d21 100644
--- a/drivers/tty/serial/8250/8250_loongson.c
+++ b/drivers/tty/serial/8250/8250_loongson.c
@@ -128,8 +128,8 @@ static int loongson_uart_probe(struct platform_device *pdev)
port->private_data = priv;
port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &priv->res);
- if (!port->membase)
- return -ENOMEM;
+ if (IS_ERR(port->membase))
+ return PTR_ERR(port->membase);
port->mapbase = priv->res->start;
port->mapsize = resource_size(priv->res);
--
2.51.0
reply other threads:[~2025-11-29 14:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aSsIa3KdAlXh5uQC@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=chenhuacai@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=zhenghaowei@loongson.cn \
--cc=zhoubinbin@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox