From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 128D23B2FEB; Thu, 28 May 2026 10:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779963873; cv=none; b=NUqbIjgXmVwlU9GccAQH7sSeQlU2bpdmy5CBwhk1K8s7E+pgdtiTTfeiyE9Y5+kxOb1px/7ekHRNsn2i1baVPFJVHNMlHvC3oMY2vu7mml5jn11t7oVUB7zalLHobN6bDB4mBsAl89HpJTEXnGZe7xD+yue0YPOfk0f9zSDOKeg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779963873; c=relaxed/simple; bh=VkqNABs6v1gE1CvlOs6Gfpl7VQbNNE60l61tqvcu6kw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M3UnXAfrwBjnlZWjnfVU1FQ9xejNLHGh6Jux2KYNOLXhWTOEAR6w8MIh2JWD12jgayp9yAx5IvANu3bwVyheGTaARW9jnoBJq1S5mn4CNWnI0lRvcaUXNa03+MarJED8rc88bLV5sCVh/ERTtxyarOzyXh3DMKrtdrNPp2VwHAQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aS4ISfHm; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aS4ISfHm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46EC81F000E9; Thu, 28 May 2026 10:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779963871; bh=Hba6xOKzIlLJw5sTi2ZReL79jUmA452phwmu2dxW8ao=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=aS4ISfHmV41rmJIm1V2p4H0CXtXm6mS+vwe1o/vDyVvf25Lp+2s2kqqwpdfIMzvSJ 6A242Q1r1N+tNodnsBU3RuqGfe2qVG2PMMkFCSqzdE334gggluKXh0MhkqDE3xsFfD yQNc6x5lbagyoG1RPvq64x8iVEZt7baX3wtzVPHkB2rj7z+fGZKRKC5/VbOn3u3peP UZbftcffX076EExKOkRtYkiJZSbEIxEbrHNDoohGyV2honUKmfoK15EN4z76Emi/DV 6Dvw2OyUGXta8L4HXAUmDblHz5c1LZSIoFhmaGpyCobr1WwfsI8nytlM46Vxmao+kO 9rjSPjLTeKXFw== From: "Mike Rapoport (Microsoft)" Date: Thu, 28 May 2026 13:24:18 +0300 Subject: [PATCH 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260528-b4-tty-v1-2-9da9f7aec5f2@kernel.org> References: <20260528-b4-tty-v1-0-9da9f7aec5f2@kernel.org> In-Reply-To: <20260528-b4-tty-v1-0-9da9f7aec5f2@kernel.org> To: Greg Kroah-Hartman , Jiri Slaby Cc: Mike Rapoport , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-serial@vger.kernel.org X-Mailer: b4 0.15.2 rs_startup() allocates a transmit ring buffer that is used to buffer reads and writes from/to serial data register. This buffer can be allocated with kmalloc() as there's nothing special about it to go directly to the page allocator. kmalloc() provides a better API that does not require ugly casts and kfree() does not need to know the size of the freed object. Replace use of get_zeroed_page() with kzalloc() and free_page() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com Signed-off-by: Mike Rapoport (Microsoft) --- drivers/tty/amiserial.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 81eaca751541..28af0fd98181 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c @@ -443,23 +443,23 @@ static int rs_startup(struct tty_struct *tty, struct serial_state *info) struct tty_port *port = &info->tport; unsigned long flags; int retval=0; - unsigned long page; + void *buffer; - page = get_zeroed_page(GFP_KERNEL); - if (!page) + buffer = kzalloc(PAGE_SIZE, GFP_KERNEL); + if (!buffer) return -ENOMEM; local_irq_save(flags); if (tty_port_initialized(port)) { - free_page(page); + kfree(buffer); goto errout; } if (info->xmit.buf) - free_page(page); + kfree(buffer); else - info->xmit.buf = (unsigned char *) page; + info->xmit.buf = buffer; #ifdef SERIAL_DEBUG_OPEN printk("starting up ttys%d ...", info->line); @@ -537,7 +537,7 @@ static void rs_shutdown(struct tty_struct *tty, struct serial_state *info) */ free_irq(IRQ_AMIGA_VERTB, info); - free_page((unsigned long)info->xmit.buf); + kfree(info->xmit.buf); info->xmit.buf = NULL; info->IER = 0; -- 2.53.0