From patchwork Sun Sep 18 16:51:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9337965 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 748416077F for ; Sun, 18 Sep 2016 16:51:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6188D28993 for ; Sun, 18 Sep 2016 16:51:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5236C28C63; Sun, 18 Sep 2016 16:51:27 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD48B28993 for ; Sun, 18 Sep 2016 16:51:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE4246E11B; Sun, 18 Sep 2016 16:51:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [217.72.192.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E7E06E115 for ; Sun, 18 Sep 2016 16:51:20 +0000 (UTC) Received: from [192.168.1.2] ([77.181.85.138]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MAMpq-1brkvS3Kf4-00BfmF; Sun, 18 Sep 2016 18:51:12 +0200 Subject: [PATCH 2/5] drm/amdgpu: Improve determination of sizes in two functions To: dri-devel@lists.freedesktop.org, Alex Deucher , =?UTF-8?Q?Christian_K=c3=b6nig?= , Chunming Zhou , David Airlie , Monk Liu , Tom St Denis References: <566ABCD9.1060404@users.sourceforge.net> <8d614254-1cba-0379-cf84-52ad9bd9f3a7@users.sourceforge.net> From: SF Markus Elfring Message-ID: <7ed4253b-6945-ddc4-aa06-56f2efa35cf1@users.sourceforge.net> Date: Sun, 18 Sep 2016 18:51:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <8d614254-1cba-0379-cf84-52ad9bd9f3a7@users.sourceforge.net> X-Provags-ID: V03:K0:eGgZZdSPs4anNCG4mL7KBF5WcF0CzLUb6s0QqUtvIES1XQRk7Pq PL/DxCVALpSN+s9OvTB+efz37fjutCiHhwXQ9rUwQ/KlZeNmiW6bvM1MpLH5QpwzeHSj8B/ 3474JJNruoBlduwN5FDl1OPN32sIZR78HZ/cGQzMZbac6zycr7ZDg9Sc9LF9p2Y3oMp7dCg KSTdzIsKP8VvSX/6V7GjQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:DQwyduoSrXM=:y3g2t70idhsKNa9p7omZiy XZhcqq9JYm8GEEaOVccGAOkcTlmZ55kG3vizTPnD5pReacfrofEO5N9Ucvils5tIzQ4e+ZZwD RKFm42SG8pabNDC78iBnTKfNdX6qzX6WloZSOixmXSV0XTMN3Rw8xXi0T1i/Enr/sFwsftTjj wfbbLdHpbtAryBM0x7Up/6xiuG78m4x0VVqV25F+SYUDQm5LP+JZcoHFVFOqSaR93AqCVrmy8 yPWW6wt5X0noKzZJfc1mWgmUiAHvtaasLjbbU4gmR+Xar4gE+zGRD0ZtAyde42ZDW0UNQHBdT SR4x5wFaoHJv5TxAhCyaSAFPu7ULtCoYuGhhWyraFTvrrn/g++GCSSxjcVvWiqYmITyFSpOEQ W3ckZdZA7cIdptSBZ/hA3nE0zbf5LUd7JTmX4qqDBT9PxBUQi4gEOgKJC7fSp8Fen02RPxlQM TKUUNONUfZT42ZFCauMZj+cHcEnt/m4YbZ4XIfNT5irO+TP+hjTLd4fTh7n9eBoKWNp48FbqN r5/TB1Wkot+n8WD5TT5km63khJ2SEJHZPKpvFF/YWgV5BYkv75g8oDjaJrYXmqTsbZLJbPuEL fI2wMbl7F13cHYLqiF461eHNV/pxGSPKvAzTxtoaMeXaJ+cEFQU5TzQWBgB4W1GI4R66LfVuM Ga+zButH5iKYse1HlN5XsztYkk/LaVawfiLTxAOw29tvME9jM70NQtSQEn7+9QaWOF+IycLed DHYmiR9O3RtS8XlH9QVXVllyL2HZmugoxflFgLb0M8g+7MpWRzNw7SMG3e3bD2SRrCdaS31OJ ocVnY4M Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 18 Sep 2016 17:24:47 +0200 Replace the specification of data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 2709ebd..96a2457 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -855,7 +855,7 @@ static void amdgpu_atombios_fini(struct amdgpu_device *adev) static int amdgpu_atombios_init(struct amdgpu_device *adev) { struct card_info *atom_card_info = - kzalloc(sizeof(struct card_info), GFP_KERNEL); + kzalloc(sizeof(*atom_card_info), GFP_KERNEL); if (!atom_card_info) return -ENOMEM; @@ -1224,7 +1224,8 @@ static int amdgpu_early_init(struct amdgpu_device *adev) } adev->ip_block_status = kcalloc(adev->num_ip_blocks, - sizeof(struct amdgpu_ip_block_status), GFP_KERNEL); + sizeof(*adev->ip_block_status), + GFP_KERNEL); if (adev->ip_block_status == NULL) return -ENOMEM;