From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946708AbdDYLPw (ORCPT ); Tue, 25 Apr 2017 07:15:52 -0400 Received: from mout.web.de ([212.227.15.14]:64379 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946608AbdDYLPm (ORCPT ); Tue, 25 Apr 2017 07:15:42 -0400 Subject: [PATCH 1/3] HSI: omap_ssi: Use devm_kcalloc() in ssi_add_controller() From: SF Markus Elfring To: Arnd Bergmann , Pavel Machek , Sebastian Reichel , Tony Lindgren Cc: LKML , kernel-janitors@vger.kernel.org References: <2fa2c33a-dc43-7e03-03d7-7ca04931e6c7@users.sourceforge.net> Message-ID: <0c285b86-6fe8-2f36-8442-474ded5edc61@users.sourceforge.net> Date: Tue, 25 Apr 2017 13:15:33 +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: <2fa2c33a-dc43-7e03-03d7-7ca04931e6c7@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:4+i0L8oMfkxvedyKJpWAs8derosiK8gF0Ru+xkcsc+98cTnXUFL epEQEHUpId2Hzxz1f+ajA/L/c+B++ZFQJvenEbyBjguIDQDhz11+sfWf9/TeQ+lsxeNUsNW leH4PCKqV90zIflnw0DLmZMfRQYviNWPgQiQRLxH1MBSmE3twP+j0NluR59ffhM5PZ8C/Yd aqiWpp/BapgspGYH9QVKQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:G9cGm8xNgDc=:qEvC1dq/IikD07U8vTZG3A mNi8W7Ex620ZvbUbbEQH3olF5ocDOsG1ya5Sb0ttPFPgJgI0IEHkYMcEq4e+10x+TEksMA8EE bXOFR9mSCm6T7le6NSBZGTfADdME+dg+zY5a6XY7QD4bVQ+pMxM5pz3OV0qMhyXERSwEHxQI4 5biO+4+b5HJ3ImYl9BvNATOeMaGEFZIMXeNGA20MwK9882B2RGk1MPE71ZrlIyfrCewjB2e47 vCNfqwJcpheUEtgBzmhynnLdODjI4DXFGl/vujGTpq26ePjL2YmYrfiMEvxFox4d+b8BXcZQ5 MnyuwNiy93cJOQ4BPnmMQAiDuOfZX7LNNNsoxrF8E7LDuLkk5AQWMnEeN5Gl/2BrsPH3qxlmL O2S4OJ707E+MnyfjRJAIbRQDJoJ5P5mC6O0Pv4GpQIJXdKtkv2KuvuXT6eV+xE8IF7qmyvYkg 0A7Y5xw4WZShwuii9A/4NGqUW8t1XExghVrB5BMWCHTfxvUTmjbWAJ5FGzZgMoewB30NpTMln Duty0Jqn7O50xNydYC35pECT43+wwPL3fKoLyoNiO5ibBbOWGxkzoBJoNQEk50KX3yQUqD7jF Bb4b8ihvXS6ZAvUAfF8w49kHexf44OMOd/dtt8a7gn3qNhqWGAzI0Ex6tvtG/KRPmRN3h3gPe 24FcMrGQJUMjt+ngl5bvMeYZzXF5RCqObF3YcmbbPIPbD7D1nPa9TxQW4D6EG81PXbc0HB/Ip PKTeeb8qgFBrfuhdrOXgTlk4qiLDdOlEZUYfaBwmgCTxvqH3ds6d0rmnSoh0An2itDKWLHiI8 1hn8CHT 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 11:20:41 +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 type 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/controllers/omap_ssi_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c index 9a29b34ed2c8..464db6d33afb 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -421,8 +421,8 @@ static int ssi_add_controller(struct hsi_controller *ssi, goto out_err; } - omap_ssi->port = devm_kzalloc(&ssi->device, - sizeof(struct omap_ssi_port *) * ssi->num_ports, GFP_KERNEL); + omap_ssi->port = devm_kcalloc(&ssi->device, ssi->num_ports, + sizeof(*omap_ssi->port), GFP_KERNEL); if (!omap_ssi->port) { err = -ENOMEM; goto out_err; -- 2.12.2