From: Pavel Machek <pavel@denx.de>
To: gregkh@linuxfoundation.org, jslaby@suse.com,
colin.king@canonical.com, jthumshirn@suse.de,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
trivial@kernel.org
Subject: [PATCH] 8250-men-mcb: fix signed/unsigned confusion
Date: Sat, 6 Jun 2020 17:11:46 +0200 [thread overview]
Message-ID: <20200606151146.GA10940@amd> (raw)
[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]
get_num_ports returns -ENODEV, and the result is stored in int, so it
should not be unsigned. Zero ports does not seem to make sense, so
make that check consistent.
Signed-off-by: Pavel Machek (CIP) <pavel@denx.de>
diff --git a/drivers/tty/serial/8250/8250_men_mcb.c b/drivers/tty/serial/8250/8250_men_mcb.c
index 3d0fcf25d8c3..89ff20fd1dd8 100644
--- a/drivers/tty/serial/8250/8250_men_mcb.c
+++ b/drivers/tty/serial/8250/8250_men_mcb.c
@@ -51,7 +51,7 @@ static u32 men_lookup_uartclk(struct mcb_device *mdev)
return clkval;
}
-static unsigned int get_num_ports(struct mcb_device *mdev,
+static int get_num_ports(struct mcb_device *mdev,
void __iomem *membase)
{
switch (mdev->id) {
@@ -140,7 +140,7 @@ static void serial_8250_men_mcb_remove(struct mcb_device *mdev)
return;
num_ports = get_num_ports(mdev, data[0].uart.port.membase);
- if (num_ports < 0 || num_ports > 4) {
+ if (num_ports <= 0 || num_ports > 4) {
dev_err(&mdev->dev, "error retrieving number of ports!\n");
return;
}
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
reply other threads:[~2020-06-06 15:11 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=20200606151146.GA10940@amd \
--to=pavel@denx.de \
--cc=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=jthumshirn@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=trivial@kernel.org \
/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.