From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Pawel Wieczorkiewicz <wpawel@gmail.com>,
gregkh@linuxfoundation.org, jslaby@suse.cz
Cc: grant.likely@secretlab.ca, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] tty: atmel_serial_probe(): index of atmel_ports[] fix
Date: Fri, 15 Mar 2013 15:36:38 +0100 [thread overview]
Message-ID: <514331F6.6070204@atmel.com> (raw)
In-Reply-To: <1361377580-10437-1-git-send-email-wpawel@gmail.com>
On 02/20/2013 05:26 PM, Pawel Wieczorkiewicz :
> From: Pawel Wieczorkiewicz <wpawel@gmail.com>
>
> Index of atmel_ports[ATMEL_MAX_UART] should be smaller
> than ATMEL_MAX_UART.
>
> Signed-off-by: Pawel Wieczorkiewicz <wpawel@gmail.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
It can be good to include this one in 3.9-rc.
I also would like to add the "stable" tag to it:
Cc: stable <stable@vger.kernel.org> # 3.2+
Greg, can you take this one or do I need to re-send it with appropriate
"stable" line?
Thanks, best regards,
> ---
> drivers/tty/serial/atmel_serial.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index d4a7c24..3467462 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -158,7 +158,7 @@ struct atmel_uart_port {
> };
>
> static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART];
> -static unsigned long atmel_ports_in_use;
> +static DECLARE_BITMAP(atmel_ports_in_use, ATMEL_MAX_UART);
>
> #ifdef SUPPORT_SYSRQ
> static struct console atmel_console;
> @@ -1769,15 +1769,14 @@ static int atmel_serial_probe(struct platform_device *pdev)
> if (ret < 0)
> /* port id not found in platform data nor device-tree aliases:
> * auto-enumerate it */
> - ret = find_first_zero_bit(&atmel_ports_in_use,
> - sizeof(atmel_ports_in_use));
> + ret = find_first_zero_bit(atmel_ports_in_use, ATMEL_MAX_UART);
>
> - if (ret > ATMEL_MAX_UART) {
> + if (ret >= ATMEL_MAX_UART) {
> ret = -ENODEV;
> goto err;
> }
>
> - if (test_and_set_bit(ret, &atmel_ports_in_use)) {
> + if (test_and_set_bit(ret, atmel_ports_in_use)) {
> /* port already in use */
> ret = -EBUSY;
> goto err;
> @@ -1857,7 +1856,7 @@ static int atmel_serial_remove(struct platform_device *pdev)
>
> /* "port" is allocated statically, so we shouldn't free it */
>
> - clear_bit(port->line, &atmel_ports_in_use);
> + clear_bit(port->line, atmel_ports_in_use);
>
> clk_put(atmel_port->clk);
>
>
--
Nicolas Ferre
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Pawel Wieczorkiewicz <wpawel@gmail.com>,
<gregkh@linuxfoundation.org>, <jslaby@suse.cz>
Cc: <grant.likely@secretlab.ca>, <linux-serial@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] tty: atmel_serial_probe(): index of atmel_ports[] fix
Date: Fri, 15 Mar 2013 15:36:38 +0100 [thread overview]
Message-ID: <514331F6.6070204@atmel.com> (raw)
In-Reply-To: <1361377580-10437-1-git-send-email-wpawel@gmail.com>
On 02/20/2013 05:26 PM, Pawel Wieczorkiewicz :
> From: Pawel Wieczorkiewicz <wpawel@gmail.com>
>
> Index of atmel_ports[ATMEL_MAX_UART] should be smaller
> than ATMEL_MAX_UART.
>
> Signed-off-by: Pawel Wieczorkiewicz <wpawel@gmail.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
It can be good to include this one in 3.9-rc.
I also would like to add the "stable" tag to it:
Cc: stable <stable@vger.kernel.org> # 3.2+
Greg, can you take this one or do I need to re-send it with appropriate
"stable" line?
Thanks, best regards,
> ---
> drivers/tty/serial/atmel_serial.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index d4a7c24..3467462 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -158,7 +158,7 @@ struct atmel_uart_port {
> };
>
> static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART];
> -static unsigned long atmel_ports_in_use;
> +static DECLARE_BITMAP(atmel_ports_in_use, ATMEL_MAX_UART);
>
> #ifdef SUPPORT_SYSRQ
> static struct console atmel_console;
> @@ -1769,15 +1769,14 @@ static int atmel_serial_probe(struct platform_device *pdev)
> if (ret < 0)
> /* port id not found in platform data nor device-tree aliases:
> * auto-enumerate it */
> - ret = find_first_zero_bit(&atmel_ports_in_use,
> - sizeof(atmel_ports_in_use));
> + ret = find_first_zero_bit(atmel_ports_in_use, ATMEL_MAX_UART);
>
> - if (ret > ATMEL_MAX_UART) {
> + if (ret >= ATMEL_MAX_UART) {
> ret = -ENODEV;
> goto err;
> }
>
> - if (test_and_set_bit(ret, &atmel_ports_in_use)) {
> + if (test_and_set_bit(ret, atmel_ports_in_use)) {
> /* port already in use */
> ret = -EBUSY;
> goto err;
> @@ -1857,7 +1856,7 @@ static int atmel_serial_remove(struct platform_device *pdev)
>
> /* "port" is allocated statically, so we shouldn't free it */
>
> - clear_bit(port->line, &atmel_ports_in_use);
> + clear_bit(port->line, atmel_ports_in_use);
>
> clk_put(atmel_port->clk);
>
>
--
Nicolas Ferre
next prev parent reply other threads:[~2013-03-15 14:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-20 16:26 [PATCH 1/1] tty: atmel_serial_probe(): index of atmel_ports[] fix Pawel Wieczorkiewicz
2013-03-15 14:36 ` Nicolas Ferre [this message]
2013-03-15 14:36 ` Nicolas Ferre
2013-03-15 14:58 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2013-02-12 23:17 Pawel Wieczorkiewicz
2013-02-20 15:00 ` Jiri Slaby
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=514331F6.6070204@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=wpawel@gmail.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.