Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1949992AbdDYU02 (ORCPT ); Tue, 25 Apr 2017 16:26:28 -0400 Received: from mout.web.de ([212.227.15.4]:63279 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1949816AbdDYU0V (ORCPT ); Tue, 25 Apr 2017 16:26:21 -0400 Subject: [PATCH 1/3] scsi: ufs: Use devm_kcalloc() in ufshcd_memory_alloc() From: SF Markus Elfring To: linux-scsi@vger.kernel.org, "James E. J. Bottomley" , "Martin K. Petersen" , Vinayak Holikatti Cc: LKML , kernel-janitors@vger.kernel.org References: <75622f45-f46c-e52f-2b9e-6ff5ce32184a@users.sourceforge.net> Message-ID: Date: Tue, 25 Apr 2017 22:26:05 +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: <75622f45-f46c-e52f-2b9e-6ff5ce32184a@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:tzwiFXWuwGGeLFurPy7Q8S93Pc712b/q/iKN1yuk4q+AYXztRd/ zgThohFNReGxe89tHmfFGda0GlxRtE6Sf+cAHtG+MeV8gypNejjj3m6637Nsq8IPMbFhL8Z jroZNT9GuTdD88kTpMizEO8D9kQk7B3lfitoQM5HyF1WesKitNQlI6mN+wg0k6+vGFa5CRR PADfs/LMCuTSRB1o70gWg== X-UI-Out-Filterresults: notjunk:1;V01:K0:f2QqOabw8nA=:arsx73k0HfFKOi4cGdanGI kOQRLUAUuU6zV5jjx+qMjzXyV5xxvrVDxsO2r6xVCOlbYu3o94RFU00p32SkovQAk6PxqvAoF J6BEvMh8uaWId3/h9tQz4wDe+YNrdIHzVT71oHMuLCUfe8wH4TJt/2MznGu21C+MJjUWkUSYW IKkGzBS1YA2nLYTnrqhzwHPJH72HUZn0zN95fHWNtgbYr1T28nHVxLbxNnEX35dLPgCMyAv78 IkczpCXuKYdPZVe/0SOVQjAr1SFxQF+wlIw4qv6QZrD9/qekZvxiI3pXEqLKEB3m/Qtqu1nLR KCB7WE2CLN0CySkdAQ0TlFzSZs9h0mSyXA74lsBdvOhQbZItlwGtxmTTXVeQQ+14FzygJJK67 ilkA9Uxr8ufwh22iI8a7kAeru6xwK5dJzSg+gdvA6nhNkR62lkL//jrzXGf8CDH3lozo5tgam 7TYHboZTJIw+cGAPp4c+7CaM/nJLbSSwFRQJUXbs+J0CF6mSJO3IHFd8dSRPdJa9KU+3pVoeo Jdaak0/ZgDDH0WNLVMQuHs6OhX42rzeO4TmWAtC6Ru3ZGONmP0XwaNV+atg6WmcD2Fhtg0H7F DgEMG6AIiK7GjPZVWXX0wvkNzTvPqCZ4SGFzBnoJGjiCe5RgmV+0BcIdBheSoLBfZbe1IBe0Z 4Zsx6Q9YbB4rGZKWnaPARcH8J9bZmKVqU+YaL/U91yWy5lsgEslvwaBMQ+pfMRDq0MwdS6hmk 7w5i9P7w2jtKvUGFx+9NSb0PBFJ59i7hdkr4plI4h+3g/wwLCa4BJKW+FY0145KWodOtVdPbW jEz29QQ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1164 Lines: 32 From: Markus Elfring Date: Tue, 25 Apr 2017 21:45:25 +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/scsi/ufs/ufshcd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 9ef8ce7f01a2..ce385911a20e 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -3270,8 +3270,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba) } /* Allocate memory for local reference block */ - hba->lrb = devm_kzalloc(hba->dev, - hba->nutrs * sizeof(struct ufshcd_lrb), + hba->lrb = devm_kcalloc(hba->dev, hba->nutrs, sizeof(*hba->lrb), GFP_KERNEL); if (!hba->lrb) { dev_err(hba->dev, "LRB Memory allocation failed\n"); -- 2.12.2