From: Jiri Slaby <jirislaby@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Walter Harms <wharms@bfs.de>,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 3/3] tty: serial: samsung_tty: Use abs() to simplify some code
Date: Mon, 12 Jun 2023 07:13:06 +0200 [thread overview]
Message-ID: <69054d03-39e5-8c42-a9a9-8934ab4bf6c9@kernel.org> (raw)
In-Reply-To: <7bd165e82ed3675d4ddee343ab373031e995a126.1686412569.git.christophe.jaillet@wanadoo.fr>
On 10. 06. 23, 17:59, Christophe JAILLET wrote:
> Use abs() instead of hand-writing it.
>
> Suggested-by: Walter Harms <wharms@bfs.de>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v2: new patch
> ---
> drivers/tty/serial/samsung_tty.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
> index 0b37019820b4..b29e9dfd81a6 100644
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
> @@ -24,6 +24,7 @@
> #include <linux/dmaengine.h>
> #include <linux/dma-mapping.h>
> #include <linux/slab.h>
> +#include <linux/math.h>
> #include <linux/module.h>
> #include <linux/ioport.h>
> #include <linux/io.h>
> @@ -1485,9 +1486,7 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport,
> }
> quot--;
>
> - calc_deviation = req_baud - baud;
> - if (calc_deviation < 0)
> - calc_deviation = -calc_deviation;
> + calc_deviation = abs(req_baud - baud);
Does this work provided req_baud and baud are unsigned?
thanks,
--
js
suse labs
next prev parent reply other threads:[~2023-06-12 5:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-10 15:59 [PATCH v2 1/3] tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() in case of error Christophe JAILLET
2023-06-10 15:59 ` [PATCH v2 2/3] tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() when iterating clk Christophe JAILLET
2023-06-12 5:27 ` Jiri Slaby
2023-06-10 15:59 ` [PATCH v2 3/3] tty: serial: samsung_tty: Use abs() to simplify some code Christophe JAILLET
2023-06-10 16:12 ` Andi Shyti
2023-06-12 5:13 ` Jiri Slaby [this message]
2023-06-12 5:31 ` Jiri Slaby
2023-06-12 5:27 ` [PATCH v2 1/3] tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() in case of error 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=69054d03-39e5-8c42-a9a9-8934ab4bf6c9@kernel.org \
--to=jirislaby@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=wharms@bfs.de \
/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
all inboxes | Powered by JetHome®