lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250827231105.126378-1-osama.abdelkader@gmail.com>
Date: Thu, 28 Aug 2025 01:11:05 +0200
From: Osama Abdelkader <osama.abdelkader@...il.com>
To: gregkh@...uxfoundation.org,
	jirislaby@...nel.org,
	andriy.shevchenko@...ux.intel.com,
	elder@...cstar.com,
	benjamin.larsson@...exis.eu,
	u.kleine-koenig@...libre.com
Cc: linux-kernel@...r.kernel.org,
	linux-serial@...r.kernel.org,
	Osama Abdelkader <osama.abdelkader@...il.com>
Subject: [PATCH] serial: 8250_of: replace kzalloc with devm_kzalloc

Use devm_kzalloc for automatic memory cleanup.

Signed-off-by: Osama Abdelkader <osama.abdelkader@...il.com>
---
 drivers/tty/serial/8250/8250_of.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index d178b6c54ea1..4fe3b79d0e4f 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -217,14 +217,14 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
 	if (of_property_read_bool(ofdev->dev.of_node, "used-by-rtas"))
 		return -EBUSY;
 
-	info = kzalloc(sizeof(*info), GFP_KERNEL);
+	info = devm_kzalloc(&ofdev->dev, sizeof(*info), GFP_KERNEL);
 	if (info == NULL)
 		return -ENOMEM;
 
 	memset(&port8250, 0, sizeof(port8250));
 	ret = of_platform_serial_setup(ofdev, port_type, &port8250, info);
 	if (ret)
-		goto err_free;
+		return ret;
 
 	if (port8250.port.fifosize)
 		port8250.capabilities = UART_CAP_FIFO;
@@ -266,8 +266,6 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
 err_dispose:
 	pm_runtime_put_sync(&ofdev->dev);
 	pm_runtime_disable(&ofdev->dev);
-err_free:
-	kfree(info);
 	return ret;
 }
 
@@ -286,7 +284,6 @@ static void of_platform_serial_remove(struct platform_device *ofdev)
 	reset_control_assert(info->rst);
 	pm_runtime_put_sync(&ofdev->dev);
 	pm_runtime_disable(&ofdev->dev);
-	kfree(info);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ