linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] serial: core: Drop duplicate NULL check in uart_*shutdown()
@ 2022-02-02 16:56 Andy Shevchenko
  2022-02-03  8:35 ` Jiri Slaby
  2022-02-04 14:29 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-02-02 16:56 UTC (permalink / raw)
  To: linux-serial, linux-kernel
  Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko

The free_page(addr), which becomes free_pages(addr, 0) checks addr
against 0. No need to repeat this check in the callers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serial/serial_core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 57f472268b6d..59f93040d807 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -328,8 +328,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
 	state->xmit.buf = NULL;
 	spin_unlock_irqrestore(&uport->lock, flags);
 
-	if (xmit_buf)
-		free_page((unsigned long)xmit_buf);
+	free_page((unsigned long)xmit_buf);
 }
 
 /**
@@ -1621,8 +1620,7 @@ static void uart_tty_port_shutdown(struct tty_port *port)
 	state->xmit.buf = NULL;
 	spin_unlock_irq(&uport->lock);
 
-	if (buf)
-		free_page((unsigned long)buf);
+	free_page((unsigned long)buf);
 }
 
 static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] serial: core: Drop duplicate NULL check in uart_*shutdown()
  2022-02-02 16:56 [PATCH v1 1/1] serial: core: Drop duplicate NULL check in uart_*shutdown() Andy Shevchenko
@ 2022-02-03  8:35 ` Jiri Slaby
  2022-02-04 14:29 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2022-02-03  8:35 UTC (permalink / raw)
  To: Andy Shevchenko, linux-serial, linux-kernel; +Cc: Greg Kroah-Hartman

On 02. 02. 22, 17:56, Andy Shevchenko wrote:
> The free_page(addr), which becomes free_pages(addr, 0) checks addr
> against 0. No need to repeat this check in the callers.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Jiri Slaby <jirislaby@kernel.org>

> ---
>   drivers/tty/serial/serial_core.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 57f472268b6d..59f93040d807 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -328,8 +328,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
>   	state->xmit.buf = NULL;
>   	spin_unlock_irqrestore(&uport->lock, flags);
>   
> -	if (xmit_buf)
> -		free_page((unsigned long)xmit_buf);
> +	free_page((unsigned long)xmit_buf);
>   }
>   
>   /**
> @@ -1621,8 +1620,7 @@ static void uart_tty_port_shutdown(struct tty_port *port)
>   	state->xmit.buf = NULL;
>   	spin_unlock_irq(&uport->lock);
>   
> -	if (buf)
> -		free_page((unsigned long)buf);
> +	free_page((unsigned long)buf);
>   }
>   
>   static void uart_wait_until_sent(struct tty_struct *tty, int timeout)

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] serial: core: Drop duplicate NULL check in uart_*shutdown()
  2022-02-02 16:56 [PATCH v1 1/1] serial: core: Drop duplicate NULL check in uart_*shutdown() Andy Shevchenko
  2022-02-03  8:35 ` Jiri Slaby
@ 2022-02-04 14:29 ` Greg Kroah-Hartman
  2022-02-04 15:27   ` Andy Shevchenko
  1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2022-02-04 14:29 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-serial, linux-kernel, Jiri Slaby

On Wed, Feb 02, 2022 at 06:56:48PM +0200, Andy Shevchenko wrote:
> The free_page(addr), which becomes free_pages(addr, 0) checks addr
> against 0. No need to repeat this check in the callers.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/tty/serial/serial_core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 57f472268b6d..59f93040d807 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -328,8 +328,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
>  	state->xmit.buf = NULL;
>  	spin_unlock_irqrestore(&uport->lock, flags);
>  
> -	if (xmit_buf)
> -		free_page((unsigned long)xmit_buf);
> +	free_page((unsigned long)xmit_buf);
>  }
>  
>  /**
> @@ -1621,8 +1620,7 @@ static void uart_tty_port_shutdown(struct tty_port *port)
>  	state->xmit.buf = NULL;
>  	spin_unlock_irq(&uport->lock);
>  
> -	if (buf)
> -		free_page((unsigned long)buf);
> +	free_page((unsigned long)buf);
>  }
>  
>  static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
> -- 
> 2.34.1
> 

What branch is this against?  It fails to apply to my tty-next branch :(

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] serial: core: Drop duplicate NULL check in uart_*shutdown()
  2022-02-04 14:29 ` Greg Kroah-Hartman
@ 2022-02-04 15:27   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2022-02-04 15:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-serial, linux-kernel, Jiri Slaby

On Fri, Feb 04, 2022 at 03:29:27PM +0100, Greg Kroah-Hartman wrote:
> On Wed, Feb 02, 2022 at 06:56:48PM +0200, Andy Shevchenko wrote:

...

> What branch is this against?  It fails to apply to my tty-next branch :(

Linux Next, I think/
Let me rebase on top of yours tty-next.

v2 has just been sent.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-04 15:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 16:56 [PATCH v1 1/1] serial: core: Drop duplicate NULL check in uart_*shutdown() Andy Shevchenko
2022-02-03  8:35 ` Jiri Slaby
2022-02-04 14:29 ` Greg Kroah-Hartman
2022-02-04 15:27   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).