From patchwork Sat Jul 22 20:26:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 124377 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp989149vqg; Sat, 22 Jul 2023 14:33:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlHPhGUtCDwIB1w6ZHpDOb9jA677Wo9zWgIkR145ZSzgBSy3M8wmMsdzxUEt5BXOQYkMtCqm X-Received: by 2002:a17:906:3f1e:b0:99b:504d:d9c7 with SMTP id c30-20020a1709063f1e00b0099b504dd9c7mr5776245ejj.67.1690061579787; Sat, 22 Jul 2023 14:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690061579; cv=none; d=google.com; s=arc-20160816; b=cJNFX3lhSD+s/RvzlNyMEGMWmWy4dDQf5kLBC/V+jGdNpCf+4kmcZN3brc6XF5QZL1 uRORzODsnNBjk/pBvQxHwdOM3iAv9wO6oKx79JPQHwaVMIxoJfwZM9jw7xq/f4SEp2z+ oCnrQWxVZrTh47SM8fFGG2eSr8Uo8hPaxwkdt9qJS0u+OACx2b46IQpw02R4IlhRBtyJ I+3ePxt3Ur9e9QKpIy2Ek6crmt3O4ODNV9FeFIk6voaYQADI9jr6FLvErx8DPGtabBb8 M+AI0VP+xzSxgPOzRnG3/W6EGlPY20b/V1n9YIJbi3n1DF9nlpZ6/JC66JhFuxpcMYnR wkcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/NfZHk2r0r5O3/cXEnU1+UoN/5FO53TePxKwYDuLCpA=; fh=jrZ7NBnEEPKdLtZRNHvuzU+hcGWNWXkVKPQ68lw0Drc=; b=F3m1ox0uZFEGJMsIqFH7CCyZyKiGyd92JaK9w0SxoDcXS85Gx2ztzxo4x3GoDEiB0k 4bZGIgNnFYKXQc5P91myh1OdIN4cZlwZJsOmPliq341hRYMF0Z596JL5dxjwNhAXKjoy g0FppD551EdLyooivTxkyOSykKtaiWtnnMedZsE1deR8mzQ7+iXA4daMsJ7hDVeuo5ab GiQpcqu5TH1bqoapWIeL1vdqUV8sD4cnAMgqw68x/xX8TArXpRUUjXcstUj+4cJK1mFE th6UAduuVhyCYpSfvt6XjF1joYI2mgvfLyaeX/fvSnlCevekiOkaxwwr52Qcs1GSOLWy brOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=PKe1cTqq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a170906130800b0099283fccb49si4251132ejb.232.2023.07.22.14.32.35; Sat, 22 Jul 2023 14:32:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=PKe1cTqq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbjGVU07 (ORCPT + 99 others); Sat, 22 Jul 2023 16:26:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbjGVU06 (ORCPT ); Sat, 22 Jul 2023 16:26:58 -0400 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA778E58 for ; Sat, 22 Jul 2023 13:26:54 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id NJBjqtestHI6nNJBjqoPCR; Sat, 22 Jul 2023 22:26:53 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1690057613; bh=/NfZHk2r0r5O3/cXEnU1+UoN/5FO53TePxKwYDuLCpA=; h=From:To:Cc:Subject:Date; b=PKe1cTqqVlcZfB/XOHKLcypj0NEfxBin5w2lxtP0qdd4RRKgRGSxn/m4HCEafiOkV TUI6F7smKn+oyoepr6K6HVUqdlW/NEgK/AaehZR2ODes5kzkTSUhYlIoflc1pjEQu/ mhqu55prWGfKSkBv/caL88GXasi9SxAQPXloIq7RDUPgXv7dNIPzV8NpbtCjN/GJLW lDa+uVb+19stEJXPiOl0oV9PVu2ce6MDSG0dkKTGVAfMAHIFG/enr10b3QvpoCMAwC VyxXO398snf6NIaQhN+OLXknMzgVjSKnFmQQ1BWxV5QiMYMRB6heVSh/fxxL6vHJPz tlt5G/3UEFAQg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 22 Jul 2023 22:26:53 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Pavel Machek , Lee Jones Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-leds@vger.kernel.org Subject: [PATCH] leds: ns2: Slightly simplify a memory allocation Date: Sat, 22 Jul 2023 22:26:49 +0200 Message-Id: <560b8f140c19a7da40f5e9540c3ef312969b0dc4.1690057595.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772158010549561406 X-GMAIL-MSGID: 1772158010549561406 Use devm_kcalloc() instead of devm_kzalloc()+array_size(). Signed-off-by: Christophe JAILLET --- drivers/leds/leds-ns2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;