Skip to contentSkip to conversation

amiserial: Drop duplicate NULL check in shutdown()

PATCH Superseded Andy Shevchenko 2 participants 2 messages Feb 2, 2022 – Feb 3, 2022 TTY layer and serial drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amiserial: Drop duplicate NULL check in shutdown()

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

---
 drivers/tty/amiserial.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/tty/amiserial.c +2 -4
index 1e60dbef676c..533d02b38e02 100644
@@ -538,10 +538,8 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
 	 */
 	free_irq(IRQ_AMIGA_VERTB, info);
 
-	if (info->xmit.buf) {
-		free_page((unsigned long) info->xmit.buf);
-		info->xmit.buf = NULL;
-	}
+	free_page((unsigned long)info->xmit.buf);
+	info->xmit.buf = NULL;
 
 	info->IER = 0;
 	amiga_custom.intena = IF_RBF | IF_TBE;
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andy Shevchenko

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

Quoted 21 lines
---
  drivers/tty/amiserial.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/tty/amiserial.c +2 -4
index 1e60dbef676c..533d02b38e02 100644
@@ -538,10 +538,8 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)
  	 */
  	free_irq(IRQ_AMIGA_VERTB, info);
 
-	if (info->xmit.buf) {
-		free_page((unsigned long) info->xmit.buf);
-		info->xmit.buf = NULL;
-	}
+	free_page((unsigned long)info->xmit.buf);
+	info->xmit.buf = NULL;
 
  	info->IER = 0;
  	amiga_custom.intena = IF_RBF | IF_TBE;
Signature · 2 lines
js
suse labs