From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1176725AbdDYIlk (ORCPT ); Tue, 25 Apr 2017 04:41:40 -0400 Received: from mout.web.de ([212.227.15.4]:61562 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1165915AbdDYIlZ (ORCPT ); Tue, 25 Apr 2017 04:41:25 -0400 Subject: [PATCH 1/3] HSI: nokia-modem: Use devm_kcalloc() in nokia_modem_gpio_probe() From: SF Markus Elfring To: Sebastian Reichel Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Tue, 25 Apr 2017 10:41:19 +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:RwVbh84ENWKuDariB/1sc6OMINShv7BcIUKOe4uLNCRp6JsCAlL jNNpoihWUmgexnqYyVKaBEJBmRX3x9K8KqvNNAiHUDT7Vb/Vr0zBPrdTAh1C0tORUVbO76d z+lUKu4W7XOSAW8F0cuLxzlHK5VwpYJDfOglsIAFNjJwYDENJfEy+v4qpXhWMv8eXAIYgfd +zqqS+Sz/8oIw+Vl6k0+w== X-UI-Out-Filterresults: notjunk:1;V01:K0:JIH2Mnt0Mco=:Lt88N5B1cMzftDdaJSjhoF JYWGbhmynzeD9GjZ+zY3wgqvV8jlNUfqW9yrumyiHm9xyvIGRA2GHOmCuerkM2wk9SHhESrdd 12TR10zmPuGyKLb6HSrOkaCPExhxi/4ThEolznRq/YLGKzZkHYicV2VXDUbHGWD5YcgPgt/kn WaC7TY7HpWdWn19digJC+PDrUyHkqdQaaEPVNBQmM9/YNHFkgEorxOEqHICGE3Wnoh4UOCvR1 Q/n/W1ejifpfp5NH24kOepDkQZ6kshnHjAHAX0FrvE4tRqMa5f6v5JxLwecho78GKRGTHKboF tiyUiYnO6zH8Io5LtVFPKDpwMIO0T6ui5Fu/U1XTb89MXqKwSa+04Hb8cUGhU6PP5KYkfz3xK 64Hpq0KomkoExZb5DiRnyieOlPhgHR4n3kcZfCS5r73sCyOGBSCyBdwFHV65XfPf4uVJ4zqcl 6AddcA66E1gp8qbhXT2frFxwur6GkxgYB7oIFXKl5MolzRi82nYXNImob6s/UPETAkePzdfv2 h/qb+tZsqk259dNj9GD0jHxkuzBlWq74cT3TmOfSP0xp+urQ+O56nGhJ75HgxdJ5AZWOkwsHs rC8+U/JIqt1U8ctZQR91Dk8SIbFtSPifTWF4rC/2QGSa0p3b0U3FB4z9Hd5abhgGAzJfBWn61 9FMQC8FH+aREBYi+eupZM4oomznNkA+ecjC6NqxqhezFK8xYa5ErBj0aAOcWxAkloVPmx1p87 kpFXGuf/ta0T9MQGu0aUm23pNCitweaI3ti8+U5HjPprcqAG1A3jf12nKM5QIlGyBLHlKIbUE qWnJYgd Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Tue, 25 Apr 2017 09:49:22 +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". This issue was detected by using the Coccinelle software. * 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/hsi/clients/nokia-modem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hsi/clients/nokia-modem.c b/drivers/hsi/clients/nokia-modem.c index c000780d931f..f6c97a0e1fcd 100644 --- a/drivers/hsi/clients/nokia-modem.c +++ b/drivers/hsi/clients/nokia-modem.c @@ -102,8 +102,8 @@ static int nokia_modem_gpio_probe(struct device *dev) return -EINVAL; } - modem->gpios = devm_kzalloc(dev, gpio_count * - sizeof(struct nokia_modem_gpio), GFP_KERNEL); + modem->gpios = devm_kcalloc(dev, gpio_count, sizeof(*modem->gpios), + GFP_KERNEL); if (!modem->gpios) { dev_err(dev, "Could not allocate memory for gpios\n"); return -ENOMEM; -- 2.12.2