Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1169488AbdDXMkh (ORCPT ); Mon, 24 Apr 2017 08:40:37 -0400 Received: from mout.web.de ([212.227.17.12]:58116 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1169398AbdDXMk3 (ORCPT ); Mon, 24 Apr 2017 08:40:29 -0400 Subject: [PATCH 1/3] extcon: Use devm_kcalloc() in extcon_dev_register() From: SF Markus Elfring To: patches@opensource.wolfsonmicro.com, Chanwoo Choi , Charles Keepax , MyungJoo Ham Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <309234f0-ce27-0db7-dc70-802b59b1cc88@users.sourceforge.net> Date: Mon, 24 Apr 2017 14:40:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:mX5TuqJQl3cteNb29ggOkYRE8Z8ffcffvh4gvjuewcMnqiOGnhV Oa3bUNMr6zEQisoXeXDM0RI31drC6sfwCtCPibIQ80zw0b3lZdQAMJQsO5G90VGTrBWgOl9 8rlwiuSTMbxfenlTZvaCwg0T8BjBEekYiS0CSw1ctSLVr90GE3Dp8hcLh0Gln2RQuJyvvjD yqNfNZGJ6+554iP2nJtYA== X-UI-Out-Filterresults: notjunk:1;V01:K0:J1Z9mP1kn24=:GsS5SqwpLQDyNinfgZAsGK NvvE79UI4a20myTUGz0hjPKMpAnosLQty1NOsdLJEkiCYqCptUMF3bhxxU210gQtcWLGBoMwR 62DFtqvd79lMOStZT52HwkIZyCgCwHi17cpE3fWmJVtgcnoFIJMNHMX0OgqesOFZgeO8pBRok Pazm0AzOtr2Iyf+a7PYr/BZ43PvHsI8gWqEdXn41w+GDBG9Ak/RjUKROndWq7noPou4ezAU81 wyu0O8juoPSmOP+0mKNGh/34CbBC68olti+4Hy/ogoB3Cd3VFD7z9XY3Rbrrizevh4KDNZ75R 8UD2Ypb/JE3JPo/uQuTfLA7QFC63SthBNQAGdlGGMXeOkJr3OGkA9iNNlNAQH3nhgxEkB7m82 jfvcqrJCmGd2FRrvGYvKCLk8CZmO7GoVRr/NgzY8fv6c6S7+2a1F73mM6csKfyxjomiHreul8 6utTL/wktJ2jlYixvRfeH8vpGC/eMRZVaZcwyQ6B6Rv2u0XA54oRLfo+rvf6GwGBPBnN7Rxe3 F/pXhmh1u/lj1I3iu53cF34n5Tkl17sHINZkD2rnFn11SJQ+wEXB90OU5z4o2AMQkCd2/BtRo h1wT+n3AA7KGgYwy6kUlUKPLpZ4DklxZP3h/EXk1hjmL9ennwRkzY7qBTbzSJJ3j/0f9CZcA2 iUHDMfiHuDak6VHTmmDTRRnxNR7zv/yCBgBTRB4hm6anemyE17wCaQF6CQndOUgTv8JNpsPvQ Wzp/jZbQikSh9pPyz81ggFXHk5LC+2ii3eKQky9MUjUEoygW3H+++JUJH/xUt1XFD4+GyMA45 I36FqAv Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 953 Lines: 30 From: Markus Elfring Date: Sun, 23 Apr 2017 20:54:11 +0200 A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "devm_kcalloc". Signed-off-by: Markus Elfring --- drivers/extcon/extcon.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index f422a78ba342..acb847bc1619 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -1252,9 +1252,8 @@ int extcon_dev_register(struct extcon_dev *edev) } spin_lock_init(&edev->lock); - - edev->nh = devm_kzalloc(&edev->dev, - sizeof(*edev->nh) * edev->max_supported, GFP_KERNEL); + edev->nh = devm_kcalloc(&edev->dev, edev->max_supported, + sizeof(*edev->nh), GFP_KERNEL); if (!edev->nh) { ret = -ENOMEM; goto err_dev; -- 2.12.2