From: Osama Abdelkader <osama.abdelkader@gmail.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
andriy.shevchenko@linux.intel.com, elder@riscstar.com,
benjamin.larsson@genexis.eu, u.kleine-koenig@baylibre.com
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Osama Abdelkader <osama.abdelkader@gmail.com>
Subject: [PATCH] serial: 8250_of: replace kzalloc with devm_kzalloc
Date: Thu, 28 Aug 2025 01:11:05 +0200 [thread overview]
Message-ID: <20250827231105.126378-1-osama.abdelkader@gmail.com> (raw)
Use devm_kzalloc for automatic memory cleanup.
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.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
next reply other threads:[~2025-08-27 23:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 23:11 Osama Abdelkader [this message]
2025-08-28 5:51 ` Greg KH
2025-08-29 9:49 ` Osama Abdelkader
2025-08-29 12:44 ` Greg KH
2025-08-29 14:19 ` Osama Abdelkader
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=20250827231105.126378-1-osama.abdelkader@gmail.com \
--to=osama.abdelkader@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=benjamin.larsson@genexis.eu \
--cc=elder@riscstar.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/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®