Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1169962AbdDXMod (ORCPT ); Mon, 24 Apr 2017 08:44:33 -0400 Received: from mout.web.de ([217.72.192.78]:51437 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1169475AbdDXMoZ (ORCPT ); Mon, 24 Apr 2017 08:44:25 -0400 Subject: [PATCH 3/3] extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs() 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: <1a203761-76b9-bf3c-c034-0bb81fe6006a@users.sourceforge.net> Date: Mon, 24 Apr 2017 14:43:55 +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:JGjg8wHyNMbzIE4P5a8b7n1hddwxVj1Sb9w7RI6REr5vWKl/UGp cTgaMeXRQyJkHFHCmXSlSPOGiYkq6AagR9t7a8+f0o3DaArqt1hs9mQkQ0cczSW2flj/1vk CvUVlrRks/fyUwgWOsEkzkT5570dFCNb8N/lN8oP+hwq9/uzugXn+J5pfGbJxoCdYQd57X0 ZsWNtkEeW2duBz4irSCIA== X-UI-Out-Filterresults: notjunk:1;V01:K0:BTVEJJj2E8A=:BUOS3VxXxARfrxTcTyDxhV WTxy/J46jdu1g3YAErFEdkEm76tuWYRC7DWog5RHC6ckKBdoAWz76VMjylHElqySv/TshAeg7 UTalNFxA8TmC4ZTKJ+0aypr65paHdbIOIWSotFNgcF1IKD8VDqmjfwyJ+Y+uvDj2gi9BNsX8R tZ2q0e8DO4eMyjJ89zFN9gLKtbCkOLfpMuLPE0fqEzXuN7ReebDJZB6tELPKQSRfrB+x4Jate VbHC6nfPnKUc8TrTyfdApsmnrRYxp7Dln9keK+ONLhiKeQ3qgpb9NWIwcSjZaHxrOc96tHjiQ 7mTg+LRlxEFKcBknSRMgRwU1e3qLUbsuwvqHxFka2NQ6dWZCc4dEXDTDRXTMataktNhN1fo6K XShd1hL5iJgloJkaMywTWzVzFFvIRoYloUDsJEEs78M5+Sm81lStDTfW/H1v/JzI05Hfwv9PH 852OjwBEeS3tqJtnVbPvMYsExWwP/eO1nHR/OXo6zEVKRlwwF68s08qnPWosVOLoV9jJz5UUX HkoKU3O61+DJp2b2HyhnXDQQbE2lgd5AekCuPIeaUb3MPla7cJ0opCXUVAlMfBAvLmEMu0Qyh APzGVGmUYowELdDI1IKR8CcptM8nGui8pCpsO1/CijURNG/lb2zbVjsHx78U6Z58yzx8i0LnV g+upVfwmnFmISwqcauIt13S+p2/DA/+yJuZjR6cBqEhSvFQWsrOGDVYuh4ooblZX2VFMyq1RL 1AjVGAiR98/5VYcZVu8SHoE5ZbCZB6zPYFhr+o+IiJb8hmsCh20nBgI/m6UgWLZ9k9Na6u9QX egD4ZTU Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1175 Lines: 33 From: Markus Elfring Date: Sun, 23 Apr 2017 22:44:19 +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". * Replace the specification of a data structure by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/extcon/extcon-arizona.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index e2d78cd7030d..f84da4a17724 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -1271,9 +1271,7 @@ static int arizona_extcon_get_micd_configs(struct device *dev, goto out; nconfs /= entries_per_config; - - micd_configs = devm_kzalloc(dev, - nconfs * sizeof(struct arizona_micd_range), + micd_configs = devm_kcalloc(dev, nconfs, sizeof(*micd_configs), GFP_KERNEL); if (!micd_configs) { ret = -ENOMEM; -- 2.12.2