From patchwork Mon May 22 12:58:54 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: 9740219 X-Patchwork-Delegate: sameo@linux.intel.com 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 9C5D260392 for ; Mon, 22 May 2017 12:59:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FB9C28703 for ; Mon, 22 May 2017 12:59:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83FC428705; Mon, 22 May 2017 12:59:30 +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 38FD028703 for ; Mon, 22 May 2017 12:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933450AbdEVM7J (ORCPT ); Mon, 22 May 2017 08:59:09 -0400 Received: from mout.web.de ([212.227.15.14]:56109 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933438AbdEVM7H (ORCPT ); Mon, 22 May 2017 08:59:07 -0400 Received: from [192.168.1.2] ([78.49.33.162]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lvk9E-1e2H3W0UlY-017SzR; Mon, 22 May 2017 14:58:58 +0200 Subject: [PATCH 1/2] NFC: digital: Improve a size determination in four functions From: SF Markus Elfring To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Samuel Ortiz , Thierry Escande Cc: LKML , kernel-janitors@vger.kernel.org References: <7e27a76c-de7a-22ec-cf8a-31aee2000e29@users.sourceforge.net> Message-ID: Date: Mon, 22 May 2017 14:58:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <7e27a76c-de7a-22ec-cf8a-31aee2000e29@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:H1Zs67cl+LQDX2fnLawtkZ8e278HqCaE2oag0thC//B/50wM5xU hYnUw8rTqudrUO5Gicn0JSaIqtwgZyIhXYfuBnYD7GR5ppRg9dRtGSsmYU14RWWE9H4dYqo aEftZdBN7ooRrl4X/YTaXTHhwoXjnqe8uqQxbVr2qee96DycOib69xgpIdhoFWeULInNaHv FlN92kVhcF5MBVoEqupvw== X-UI-Out-Filterresults: notjunk:1; V01:K0:D5906XsChes=:DV2UMIkYGB94+XhcMsK5mQ t14PDeIeJHQhZYmqq7Q4TOST91wM//D4nBvsa8fKiG2cDxIGUkomShSZ0wig3NGIhmXIPbOqO h0jU+GKk7sRQ80VrNk/UgQFMKPhGK1eX9u9nrncEz3ipZ2D6iY3wHUyPJON39ygVCFsLvv5WP xFyTEbGh+avU+AxbF34+fRpwFNfRVbC/mYvcOk5/n6kF2F4KE08NNHCGxA35jIwyDs6a+PEHz oSlI+MgU6EgRM99m0gx0kJhRvCYaiG7qRnOyDkvDO1Yb/W+KsVwnjF70umL9b8b6yvhSGhNr1 qaLvTQ/Mfl+ybsrgrMA9aYpGxX5jGvqEQmqVIvzTUsKn7nz1GRdtPMHwQ7BO/LZI8T9tyR2wp CbW2DObtCPRJZlJSUEllymFecZl+mmJkcJL4aFc9aIEkHSVFuB+qdMmiK0FcVFzwn+NfsSZ3p KZ6MNCDT47XU3KQ4glYMlRzQjyqgV8tzxmGqyXo6uLMwpMAfpmb8id0K/RI7O0rXObq1qKsKa k2JDtXhtzchhJqAUewNZKfoydV70ekPjgxu+TjrreDhXcMOb+UY9E2N+9/PUfpqZE+Yttn29q tdM7LJ6aT0jSM/eo0EzUXdlP91CrAV4FKL73gzbaiTGm0T4RLhnVGC+IDqKRwMPv/Vg41y36z ozDkmBbqkkxxgIy/vLs7oublavr9HntHPRFTFieV/YRkvpDfoPGB4D2MbRXig/srGZ+AP/Tyk 0kmEESZl4onjXjufthjbslYQ0cJYSRhAOAGOfZE0scKQVScKEnOb/byJub64QbWvHc5JDv0dj 2usDG/T Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 22 May 2017 14:11:01 +0200 Replace the specification of four 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 --- net/nfc/digital_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c index 0fd5518bf252..3baf91f3ef80 100644 --- a/net/nfc/digital_core.c +++ b/net/nfc/digital_core.c @@ -240,5 +240,5 @@ int digital_send_cmd(struct nfc_digital_dev *ddev, u8 cmd_type, { struct digital_cmd *cmd; - cmd = kzalloc(sizeof(struct digital_cmd), GFP_KERNEL); + cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); if (!cmd) @@ -287,5 +287,5 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) { struct digital_tg_mdaa_params *params; - params = kzalloc(sizeof(struct digital_tg_mdaa_params), GFP_KERNEL); + params = kzalloc(sizeof(*params), GFP_KERNEL); if (!params) @@ -706,5 +706,5 @@ static int digital_in_send(struct nfc_dev *nfc_dev, struct nfc_target *target, struct digital_data_exch *data_exch; int rc; - data_exch = kzalloc(sizeof(struct digital_data_exch), GFP_KERNEL); + data_exch = kzalloc(sizeof(*data_exch), GFP_KERNEL); if (!data_exch) { @@ -764,5 +764,5 @@ struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops, !ops->switch_rf || (ops->tg_listen_md && !ops->tg_get_rf_tech)) return NULL; - ddev = kzalloc(sizeof(struct nfc_digital_dev), GFP_KERNEL); + ddev = kzalloc(sizeof(*ddev), GFP_KERNEL); if (!ddev)