All of lore.kernel.org
 help / color / mirror / Atom feed
From: 'Wei Yongjun <weiyongjun1@huawei.com>
To: <weiyongjun1@huawei.com>, Karol Gugala <kgugala@antmicro.com>,
	"Mateusz Holenko" <mholenko@antmicro.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	"Filip Kokosinski" <fkokosinski@antmicro.com>
Cc: <linux-serial@vger.kernel.org>, <kernel-janitors@vger.kernel.org>,
	"Hulk Robot" <hulkci@huawei.com>
Subject: [PATCH -next] serial: liteuart: fix return value check in liteuart_probe()
Date: Fri, 5 Mar 2021 03:49:29 +0000	[thread overview]
Message-ID: <20210305034929.3234352-1-weiyongjun1@huawei.com> (raw)

From: Wei Yongjun <weiyongjun1@huawei.com>

In case of error, the function devm_platform_get_and_ioremap_resource()
returns ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Fixes: 1da81e5562fa ("drivers/tty/serial: add LiteUART driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/tty/serial/liteuart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
index 64842f3539e1..0b06770642cb 100644
--- a/drivers/tty/serial/liteuart.c
+++ b/drivers/tty/serial/liteuart.c
@@ -270,8 +270,8 @@ static int liteuart_probe(struct platform_device *pdev)
 
 	/* get membase */
 	port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
-	if (!port->membase)
-		return -ENXIO;
+	if (IS_ERR(port->membase))
+		return PTR_ERR(port->membase);
 
 	/* values not from device tree */
 	port->dev = &pdev->dev;


                 reply	other threads:[~2021-03-05  3:40 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=20210305034929.3234352-1-weiyongjun1@huawei.com \
    --to=weiyongjun1@huawei.com \
    --cc=fkokosinski@antmicro.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hulkci@huawei.com \
    --cc=jirislaby@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kgugala@antmicro.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=mholenko@antmicro.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.