* [PATCH] mfd: dln2: Switch to managed resources and fix bare unsigned types
@ 2026-03-03 18:32 Subhash Rawat
2026-03-06 14:10 ` (subset) " Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Subhash Rawat @ 2026-03-03 18:32 UTC (permalink / raw)
To: lee; +Cc: linux-kernel, Subhash Rawat
Convert dln2_probe and dln2_setup_rx_urbs to use devm_kzalloc() and
devm_kmalloc() respectively. This simplifies resource management by
allowing the removal of manual kfree() calls in dln2_free() and
dln2_free_rx_urbs().
Additionally, update bare 'unsigned' types to 'unsigned int' to satisfy
checkpatch.pl warnings and comply with the Linux kernel coding style.
Signed-off-by: Subhash Rawat <rawatsubhash02@gmail.com>
---
drivers/mfd/dln2.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index d12510e39..7f281b409 100644
--- a/drivers/mfd/dln2.c
+++ b/drivers/mfd/dln2.c
@@ -424,8 +424,8 @@ static void free_rx_slot(struct dln2_dev *dln2, u16 handle, int slot)
}
static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
- const void *obuf, unsigned obuf_len,
- void *ibuf, unsigned *ibuf_len)
+ const void *obuf, unsigned int obuf_len,
+ void *ibuf, unsigned int *ibuf_len)
{
int ret = 0;
int rx_slot;
@@ -511,8 +511,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
}
int dln2_transfer(struct platform_device *pdev, u16 cmd,
- const void *obuf, unsigned obuf_len,
- void *ibuf, unsigned *ibuf_len)
+ const void *obuf, unsigned int obuf_len,
+ void *ibuf, unsigned int *ibuf_len)
{
struct dln2_platform_data *dln2_pdata;
struct dln2_dev *dln2;
@@ -583,10 +583,8 @@ static void dln2_free_rx_urbs(struct dln2_dev *dln2)
{
int i;
- for (i = 0; i < DLN2_MAX_URBS; i++) {
+ for (i = 0; i < DLN2_MAX_URBS; i++)
usb_free_urb(dln2->rx_urb[i]);
- kfree(dln2->rx_buf[i]);
- }
}
static void dln2_stop_rx_urbs(struct dln2_dev *dln2)
@@ -601,7 +599,6 @@ static void dln2_free(struct dln2_dev *dln2)
{
dln2_free_rx_urbs(dln2);
usb_put_dev(dln2->usb_dev);
- kfree(dln2);
}
static int dln2_setup_rx_urbs(struct dln2_dev *dln2,
@@ -609,9 +606,10 @@ static int dln2_setup_rx_urbs(struct dln2_dev *dln2,
{
int i;
const int rx_max_size = DLN2_RX_BUF_SIZE;
+ struct device *dev = &dln2->interface->dev;
for (i = 0; i < DLN2_MAX_URBS; i++) {
- dln2->rx_buf[i] = kmalloc(rx_max_size, GFP_KERNEL);
+ dln2->rx_buf[i] = devm_kmalloc(dev, rx_max_size, GFP_KERNEL);
if (!dln2->rx_buf[i])
return -ENOMEM;
@@ -778,7 +776,7 @@ static int dln2_probe(struct usb_interface *interface,
if (ret)
return ret;
- dln2 = kzalloc_obj(*dln2);
+ dln2 = devm_kzalloc(dev, sizeof(*dln2), GFP_KERNEL);
if (!dln2)
return -ENOMEM;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: (subset) [PATCH] mfd: dln2: Switch to managed resources and fix bare unsigned types
2026-03-03 18:32 [PATCH] mfd: dln2: Switch to managed resources and fix bare unsigned types Subhash Rawat
@ 2026-03-06 14:10 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-03-06 14:10 UTC (permalink / raw)
To: lee, Subhash Rawat; +Cc: linux-kernel
On Tue, 03 Mar 2026 18:32:36 +0000, Subhash Rawat wrote:
> Convert dln2_probe and dln2_setup_rx_urbs to use devm_kzalloc() and
> devm_kmalloc() respectively. This simplifies resource management by
> allowing the removal of manual kfree() calls in dln2_free() and
> dln2_free_rx_urbs().
>
> Additionally, update bare 'unsigned' types to 'unsigned int' to satisfy
> checkpatch.pl warnings and comply with the Linux kernel coding style.
>
> [...]
Applied, thanks!
[1/1] mfd: dln2: Switch to managed resources and fix bare unsigned types
commit: e95325f037e5b78c7cf0e614872337c1b0151fa4
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-06 14:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-03 18:32 [PATCH] mfd: dln2: Switch to managed resources and fix bare unsigned types Subhash Rawat
2026-03-06 14:10 ` (subset) " Lee Jones
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®