From patchwork Tue Apr 25 20:26:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9699621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9BC8860224 for ; Tue, 25 Apr 2017 20:26:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B59E284DC for ; Tue, 25 Apr 2017 20:26:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 804BC2865D; Tue, 25 Apr 2017 20:26:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27A38284DC for ; Tue, 25 Apr 2017 20:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1949876AbdDYU0Y (ORCPT ); Tue, 25 Apr 2017 16:26:24 -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 Received: from [192.168.1.2] ([92.228.145.161]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LtWsu-1c2JiM1B36-010tAt; Tue, 25 Apr 2017 22:26:06 +0200 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-Language: en-GB 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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Subhash Jadavani --- 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");