All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] axis-fifo: use devm_kasprintf for device name
@ 2023-05-13 21:40 Prathu Baronia
  2023-05-14  6:37 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 30+ messages in thread
From: Prathu Baronia @ 2023-05-13 21:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Prathu Baronia, linux-staging, linux-kernel

- Replaces devm_kzalloc and snprintf combo.
- Also made the fops alignment proper.

Signed-off-by: Prathu Baronia <prathubaronia2011@gmail.com>
---
 drivers/staging/axis-fifo/axis-fifo.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/axis-fifo/axis-fifo.c b/drivers/staging/axis-fifo/axis-fifo.c
index dfd2b357f484..8b46699efb34 100644
--- a/drivers/staging/axis-fifo/axis-fifo.c
+++ b/drivers/staging/axis-fifo/axis-fifo.c
@@ -720,11 +720,11 @@ static int axis_fifo_close(struct inode *inod, struct file *f)
 }
 
 static const struct file_operations fops = {
-	.owner = THIS_MODULE,
-	.open = axis_fifo_open,
+	.owner   = THIS_MODULE,
+	.open    = axis_fifo_open,
 	.release = axis_fifo_close,
-	.read = axis_fifo_read,
-	.write = axis_fifo_write
+	.read    = axis_fifo_read,
+	.write   = axis_fifo_write
 };
 
 /* read named property from the device tree */
@@ -820,10 +820,6 @@ static int axis_fifo_probe(struct platform_device *pdev)
 	 * ----------------------------
 	 */
 
-	device_name = devm_kzalloc(dev, 32, GFP_KERNEL);
-	if (!device_name)
-		return -ENOMEM;
-
 	/* allocate device wrapper memory */
 	fifo = devm_kzalloc(dev, sizeof(*fifo), GFP_KERNEL);
 	if (!fifo)
@@ -861,7 +857,9 @@ static int axis_fifo_probe(struct platform_device *pdev)
 	dev_dbg(fifo->dt_device, "remapped memory to 0x%p\n", fifo->base_addr);
 
 	/* create unique device name */
-	snprintf(device_name, 32, "%s_%pa", DRIVER_NAME, &r_mem->start);
+	device_name = devm_kasprintf(dev, GFP_KERNEL, "%s_%pa", DRIVER_NAME, &r_mem->start);
+	if (!device_name)
+		return -ENOMEM;
 	dev_dbg(fifo->dt_device, "device name [%s]\n", device_name);
 
 	/* ----------------------------
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2023-06-20  9:24 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-13 21:40 [PATCH] axis-fifo: use devm_kasprintf for device name Prathu Baronia
2023-05-14  6:37 ` Greg Kroah-Hartman
2023-05-14 13:01   ` Prathu Baronia
2023-05-14 13:01     ` [PATCH v2 1/2] axis-fifo: use devm_kasprintf() for allocating formatted strings Prathu Baronia
2023-05-15  7:42       ` Dan Carpenter
2023-05-18 14:31         ` Prathu Baronia
2023-05-18 14:51           ` [PATCH v3 " Prathu Baronia
2023-05-18 14:51             ` [PATCH v3 2/2] axis-fifo: cleanup space issues with fops struct Prathu Baronia
2023-05-27  7:35             ` [PATCH v3 1/2] axis-fifo: use devm_kasprintf() for allocating formatted strings Greg KH
2023-05-27  8:53               ` Prathu Baronia
2023-05-27 11:50                 ` [PATCH v4 1/3] axis-fifo: fix smatch warning for format specifier Prathu Baronia
2023-05-27 11:50                   ` [PATCH v4 2/3] axis-fifo: use devm_kasprintf() for allocating formatted strings Prathu Baronia
2023-05-28  9:00                     ` Greg Kroah-Hartman
2023-06-13 16:03                       ` Prathu Baronia
2023-05-27 11:51                   ` [PATCH v4 3/3] axis-fifo: cleanup space issues with fops struct Prathu Baronia
2023-05-27 22:31                     ` Uwe Kleine-König
2023-05-28  8:57                       ` Greg Kroah-Hartman
2023-06-13 16:01                         ` Prathu Baronia
2023-06-13 15:56                       ` Prathu Baronia
2023-05-28  8:59                   ` [PATCH v4 1/3] axis-fifo: fix smatch warning for format specifier Greg Kroah-Hartman
2023-06-13 16:02                     ` Prathu Baronia
2023-06-16 15:25                       ` [PATCH v5 1/2] axis-fifo: use devm_kasprintf() for allocating formatted strings Prathu Baronia
2023-06-16 15:26                         ` [PATCH v5 2/2] axis-fifo: remove the unnecessary dev_info() Prathu Baronia
2023-06-17 14:00                         ` [PATCH v5 1/2] axis-fifo: use devm_kasprintf() for allocating formatted strings Greg Kroah-Hartman
2023-06-19  6:43                           ` Prathu Baronia
2023-06-19 16:22                             ` [PATCH v6 " Prathu Baronia
2023-06-19 16:22                               ` [PATCH v6 2/2] axis-fifo: change device name by assigning unique device id Prathu Baronia
2023-06-20  5:18                               ` [PATCH v6 1/2] axis-fifo: use devm_kasprintf() for allocating formatted strings Dan Carpenter
2023-06-20  9:24                               ` Greg Kroah-Hartman
2023-05-14 13:01     ` [PATCH v2 2/2] axis-fifo: cleanup space issues with fops struct Prathu Baronia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.