From patchwork Mon Sep 18 13:56:25 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: 9956765 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 4FED9601E9 for ; Mon, 18 Sep 2017 13:56:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41F8F289F3 for ; Mon, 18 Sep 2017 13:56:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36C5D28A05; Mon, 18 Sep 2017 13:56:50 +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=unavailable 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 E4474289F3 for ; Mon, 18 Sep 2017 13:56:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755766AbdIRN4f (ORCPT ); Mon, 18 Sep 2017 09:56:35 -0400 Received: from mout.web.de ([212.227.17.12]:65055 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753691AbdIRN4d (ORCPT ); Mon, 18 Sep 2017 09:56:33 -0400 Received: from [192.168.1.2] ([78.48.130.71]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M3Bdr-1daDj447aJ-00sz0K; Mon, 18 Sep 2017 15:56:26 +0200 Subject: [PATCH 3/6] [media] go7007: Improve a size determination in four functions From: SF Markus Elfring To: linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <092d6885-5101-73b2-bb69-42873d940369@users.sourceforge.net> Date: Mon, 18 Sep 2017 15:56:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:caKVSdvX2VhppFaKxd5s2po4Djuw+LwlFw9x/Wtc6VpRJsRcpFI KKUDJGH0/YpRJNRvbehbIGqpEqI564++Pv5siG0z/sry6pCBEozttmFz5wRTOTgsqs59AhK Gug0qPLg21nxfECpCmTgI9DjfA0d/b2Dgx11tOspsP3Ll1hFALLqnmI8Udr5BrWI/jRB7LF KIrsurtzAsT/Y2la9T97A== X-UI-Out-Filterresults: notjunk:1; V01:K0:i4UUI4riA/g=:l+TIu8N9IgMqYKd7e86rLn PA6dseiGx1HirmwiOYDg/JDstaGWAD4AhD7H23qDa2Ztw3SfQi3p82o7MQKLEbzv7+o7sNIBr vOYvA2snS4UEsiFcGu+bSEy1bZs2sVb5jYMMKklZjA4iQQzN58hefLu1yJKV3qpd8cKncSjSV EfKUaUW/ArdnfTy2VvsoUhVVrLPp8Z158pfRe7FOH+l3dBSgHC3CLa10p0uQMK59+uc4EyNNL SvgA/9A7DiihYnd9x4ziH6oJNGFj9WbqTeucxYUl85Y83bxiu8sMBCjvOSI7G/G+Wccu/N3un PPkMTZjnSl9J7pmKo6u2Q8I5to7pH8GFP536vkTdj+/+P7jORCC4EFVQGrLwXNfphUlNbx2Tw KPKE/pjn49HNBGersWZHCLz/6J1oeC6P6Id/IlZa3SlGyX8/97M7uoXsDVqfojNxsvzOPjpSN gdxsDEaIK6aL3rH1mTbckEoih3UO2343orBKdCvqWuQHHL21VXQz7NWVhJeSF4q2ySgO0YjPH IuSfhZ+Rfn4RRYm/e/GFWLHbw0qEPAOVs9/4eZwdq4BJMN+FYhFbSLW4p8AUL5GJ7IdydhHJl IbZMzYT6sUNeQKpmqpN03Q23nPLa5a3WJk9EuaEMAsV8iJiCHscaotjZUECrekENUPjrUzu6N tkrlTME3q43yIQVuz8yVpBILsxvmGI+HLvwMWxvGFqMs6vM80J+42sIx35xG8BnqOjuQFHcDp fsddq7Av7ydPAjtx51SqhlfBnEKW11jLs05gLcc+AW6fJ/3zKW9rsxi0he0oFu4UJVNN2Sacm 8f5wErjSOm3w8laY0aqUWTp6hrCA+/7NoglO2GBhSdmkPba2HQ= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 18 Sep 2017 11:27:30 +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. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/usb/go7007/go7007-driver.c | 2 +- drivers/media/usb/go7007/go7007-usb.c | 2 +- drivers/media/usb/go7007/s2250-board.c | 2 +- drivers/media/usb/go7007/snd-go7007.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/go7007/go7007-driver.c b/drivers/media/usb/go7007/go7007-driver.c index 390f66ec8fd2..f8c06b2f9d2f 100644 --- a/drivers/media/usb/go7007/go7007-driver.c +++ b/drivers/media/usb/go7007/go7007-driver.c @@ -699,5 +699,5 @@ struct go7007 *go7007_alloc(const struct go7007_board_info *board, struct go7007 *go; int i; - go = kzalloc(sizeof(struct go7007), GFP_KERNEL); + go = kzalloc(sizeof(*go), GFP_KERNEL); if (!go) diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c index 5ad40b77763d..f0f70a92541a 100644 --- a/drivers/media/usb/go7007/go7007-usb.c +++ b/drivers/media/usb/go7007/go7007-usb.c @@ -1122,5 +1122,5 @@ static int go7007_usb_probe(struct usb_interface *intf, if (!go) return -ENOMEM; - usb = kzalloc(sizeof(struct go7007_usb), GFP_KERNEL); + usb = kzalloc(sizeof(*usb), GFP_KERNEL); if (!usb) { diff --git a/drivers/media/usb/go7007/s2250-board.c b/drivers/media/usb/go7007/s2250-board.c index d987c5f2b45a..1fd4c09dd516 100644 --- a/drivers/media/usb/go7007/s2250-board.c +++ b/drivers/media/usb/go7007/s2250-board.c @@ -515,5 +515,5 @@ static int s2250_probe(struct i2c_client *client, if (!audio) return -ENOMEM; - state = kzalloc(sizeof(struct s2250), GFP_KERNEL); + state = kzalloc(sizeof(*state), GFP_KERNEL); if (!state) { diff --git a/drivers/media/usb/go7007/snd-go7007.c b/drivers/media/usb/go7007/snd-go7007.c index 4e612cf1afd9..68e421bf38e1 100644 --- a/drivers/media/usb/go7007/snd-go7007.c +++ b/drivers/media/usb/go7007/snd-go7007.c @@ -235,5 +235,5 @@ int go7007_snd_init(struct go7007 *go) dev++; return -ENOENT; } - gosnd = kmalloc(sizeof(struct go7007_snd), GFP_KERNEL); + gosnd = kmalloc(sizeof(*gosnd), GFP_KERNEL); if (!gosnd)