From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755066AbdDRQx6 (ORCPT ); Tue, 18 Apr 2017 12:53:58 -0400 Received: from mout.web.de ([212.227.15.14]:49552 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbdDRQxx (ORCPT ); Tue, 18 Apr 2017 12:53:53 -0400 Subject: [PATCH 3/6] ACPI-nfit: Use devm_kcalloc() in nfit_mem_dcr_init() From: SF Markus Elfring To: linux-acpi@vger.kernel.org, Borislav Petkov , Chun-Yi Lee , Colin Ian King , Dan Williams , Len Brown , Linda Knippers , "Rafael J. Wysocki" , Tony Luck , Vishal Verma , Zhang Rui Cc: LKML , kernel-janitors@vger.kernel.org References: <077115e4-8ec3-9c6d-0374-8ffc5e0f85c0@users.sourceforge.net> Message-ID: Date: Tue, 18 Apr 2017 18:53:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <077115e4-8ec3-9c6d-0374-8ffc5e0f85c0@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:wL24fdxxG3neCl4B9K0wlBLMc0NXIut6LJGnLsrIJc8bgLqrUUy 6IfJlpLppdAwFwe+Y1yPD/WjagbMO+uMlGKkFa/qCc3XtZXQ38xiD+fLJUobsnJtQhqbfPa 6DNh9gC+vgxSGs+3d+O7Az/kY3pr3bpHG70vAzNUYYNLHjjcpXaSqX+ybT6CaetmvWOCM4m r/5r/dDM45nGvM3wam53A== X-UI-Out-Filterresults: notjunk:1;V01:K0:Ilg6D9UdUxk=:bt5Ne3d8HgrHtWcMiWjSJQ bAvgnHYS6TqsqrmPKsPKZOScj13/55W/vJ88rjiFNvI/FKFwmRSTIha++hJXeAgh9grIDt8qT wMIuxYAiKiiyyL4Nemb99NzberxrEWCH+KVaCiG2ilMzpf8XoK93iRw+Grx47k/lEf/fKv7oE Pyb+RY0bffHvuJGg/fkrQho+JNNLWvmtVrxyjjA4ZpvPUksHxx+1Dv+sVrWitIg/oG5pJp7+P ct2xZhGSy8b6OpPo6tAYCxtLErq93v/vLigE4DRTr0VQT01UhfzxWufcJi37cdHHfkrD+IL/c 5q58PfvszEO/EcDKL0n8QWJGewIfBtIRlqVbFcfhKHPYNqT/PiRshwyn+C7fl5MXo8xI5HpM6 uM3q5gK7on9kQmEo+SWX9B2vo0IWU7SfeCsAkOJ1bDvKH69DTRi+8rfCK4IExDAGV79dwg+G1 kVBuSRf9vhkrLRjC/7VGAISe8l3z2KeEqK9BFCB3DURLuPoQLw+ecrZ0VDbPq3kizFVSWYe35 zhj/VmHBfqVWoRDafh+wNPPF/5h0xJCfCJJKxKtiR4YbOfFd/jodBuFNOmMoXKHRY8rgUjAcd +PO2QM6zk20B+UFVS/0obBnfmbFE4HyYwYKH/G8Rbv+Yr6KXt88i1ZBrHfVt9n6iTQ25Y9vQp NGyJmw/55wtk5Wa61z4H5lsKXf+805Mbqkv1XosXNtXJcf5h7qn/mpQxS4QQ6NKHR1Bi+EhEu aFLL4Ndoz5Yszngq41y2hAMU1iCfOUJ7OKyUyxrxCvea4XY/ldYr2OP6jj1DE8TuUNePWvzfR DLf1jYQ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Tue, 18 Apr 2017 17:30:15 +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/acpi/nfit/core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 462e77272272..1aa625dc424a 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -809,9 +809,11 @@ static int nfit_mem_dcr_init(struct acpi_nfit_desc *acpi_desc, continue; nfit_mem->nfit_flush = nfit_flush; flush = nfit_flush->flush; - nfit_mem->flush_wpq = devm_kzalloc(acpi_desc->dev, - flush->hint_count - * sizeof(struct resource), GFP_KERNEL); + nfit_mem->flush_wpq + = devm_kcalloc(acpi_desc->dev, + flush->hint_count, + sizeof(*nfit_mem->flush_wpq), + GFP_KERNEL); if (!nfit_mem->flush_wpq) return -ENOMEM; for (i = 0; i < flush->hint_count; i++) { -- 2.12.2