diff mbox series

leds: ns2: Slightly simplify a memory allocation

Message ID 560b8f140c19a7da40f5e9540c3ef312969b0dc4.1690057595.git.christophe.jaillet@wanadoo.fr
State New
Headers show
Series leds: ns2: Slightly simplify a memory allocation | expand

Commit Message

Christophe JAILLET July 22, 2023, 8:26 p.m. UTC
Use devm_kcalloc() instead of devm_kzalloc()+array_size().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/leds/leds-ns2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lee Jones July 28, 2023, 10:58 a.m. UTC | #1
On Sat, 22 Jul 2023 22:26:49 +0200, Christophe JAILLET wrote:
> Use devm_kcalloc() instead of devm_kzalloc()+array_size().
> 
> 

Applied, thanks!

[1/1] leds: ns2: Slightly simplify a memory allocation
      commit: c8a039436525072af7e77f540d21f0d312fc7c38

--
Lee Jones [李琼斯]
diff mbox series

Patch

diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c
index 1677d66d8b0e..f3010c472bbd 100644
--- a/drivers/leds/leds-ns2.c
+++ b/drivers/leds/leds-ns2.c
@@ -247,7 +247,7 @@  static int ns2_led_probe(struct platform_device *pdev)
 	if (!count)
 		return -ENODEV;
 
-	leds = devm_kzalloc(dev, array_size(sizeof(*leds), count), GFP_KERNEL);
+	leds = devm_kcalloc(dev, count, sizeof(*leds), GFP_KERNEL);
 	if (!leds)
 		return -ENOMEM;