From patchwork Sun Sep 17 08:20:55 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: 9954671 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 15B31603F2 for ; Sun, 17 Sep 2017 08:21:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 037D328A7D for ; Sun, 17 Sep 2017 08:21:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC786288F6; Sun, 17 Sep 2017 08:21:42 +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 B077D28760 for ; Sun, 17 Sep 2017 08:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751473AbdIQIVJ (ORCPT ); Sun, 17 Sep 2017 04:21:09 -0400 Received: from mout.web.de ([212.227.17.12]:62852 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750793AbdIQIVH (ORCPT ); Sun, 17 Sep 2017 04:21:07 -0400 Received: from [192.168.1.2] ([77.181.201.34]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MXpZD-1dwXrs3fzb-00WnIF; Sun, 17 Sep 2017 10:20:55 +0200 Subject: [PATCH 2/2] [media] tda18212: Improve three size determinations From: SF Markus Elfring To: linux-media@vger.kernel.org, Antti Palosaari , Mauro Carvalho Chehab Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Sun, 17 Sep 2017 10:20:55 +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:teZlge/OsFmn8nbgbGgJEOHyHyhuZVOd7p6pmRaS6x7esXdnlqA 69z6mFKJSITu9P71i9Jtd2ThIAT+z/7PF665RAsfyHaDa4o2fpnlSHTg8hXFKf3t71fi6Zb iUy0Cgsjv71wxJBcz3I+Zoip4FlmOCFSnhIYeZk/x2sPmGiehZnKoPTW7CgW+5I+CEYjF4V SbAjZVO/yom+GBaUkgcYg== X-UI-Out-Filterresults: notjunk:1; V01:K0:PjC6lGqYkfA=:MPFQenvHaDFJk+8PyJMd2C 6ziOWyl7FuPgw31nf5rlhqj8K99KKbKMRUvctXM+UlBZKcAByFCc+Gld/q519AGIFf3jvei89 m6MO1LTkdj3TlEthitT5cNei03FwNBi1eA7SZIN5Mj4v5OZw04R4Ux08SmPSttCeCTZQcDi/K ER4JaSVHVH//tBWGwbG5nPMzaQtgB7YOLuhw1GJ4ntKZbDcPEYTpV5AF+t3H1MrGCQcwMWF+o I4rTdkvN6YT5WHyId4ykV5s6ExnvwJZCpxbFcUbpqlxSTlWlDcVoyNEdoNPtK2iUo0bWqXtgl fXpwTD7ZEHKiO15SX1krUF4T6QN4wCKr5uroprPCEVkiUXsrU0TpGOX1+Ld2CD2NBqmmN86LW fvLz3TS4RXMznzt4MYw6/KAyanWQx+CmGVvNOcew9VLOoJUPrp+y35NNZK5wMRt9MyHyDqyM2 1bh8OzZSsNcMGaR7sdCUPRuSuLQ5y4YsodEqi5Ho4w1HDfvGeGGX8r/mwwC/6Wy/s51rVn/bj hl+f6I0d9bPlzdGYm4VE7qZl8DePGlA+k/LhCPF7cxhEGbtSNBYleBka45r0PB8Nw9MGrg074 JkNOVvh1RbAiNW5qEkVUKvCu/lFO767wVDAg1YbCDfu681bBD2gCOjx0q2+J+3713QobLZ8Tc rk07+Q2XFDve6HDiWrSx7UR93uIFo8yI3XyhuR29FLGNCqt4NYeuwRrpqP+gMCLBPQIowwBI7 qcHdhg7lfHgMZzLZTN9P2/PgLck5rBQ59cC31KEuhh512JxmjKqiUFBadTajzFFOsLe121pka Pg8PHqBgfeN0kDUCY+iwzr20K+xhfm5g0HWdRWe7zaPD6TFGZM= 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: Sun, 17 Sep 2017 09:42:17 +0200 Replace the specification of data structures by variable references 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/media/tuners/tda18212.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c index 8f89d52cd39c..16a90d75f7d4 100644 --- a/drivers/media/tuners/tda18212.c +++ b/drivers/media/tuners/tda18212.c @@ -207,6 +207,6 @@ static int tda18212_probe(struct i2c_client *client, } - memcpy(&dev->cfg, cfg, sizeof(struct tda18212_config)); + memcpy(&dev->cfg, cfg, sizeof(*cfg)); dev->client = client; dev->regmap = devm_regmap_init_i2c(client, ®map_config); if (IS_ERR(dev->regmap)) { @@ -244,7 +244,7 @@ static int tda18212_probe(struct i2c_client *client, fe->tuner_priv = dev; memcpy(&fe->ops.tuner_ops, &tda18212_tuner_ops, - sizeof(struct dvb_tuner_ops)); + sizeof(fe->ops.tuner_ops)); i2c_set_clientdata(client, dev); return 0; @@ -261,8 +261,7 @@ static int tda18212_remove(struct i2c_client *client) struct dvb_frontend *fe = dev->cfg.fe; dev_dbg(&client->dev, "\n"); - - memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops)); + memset(&fe->ops.tuner_ops, 0, sizeof(fe->ops.tuner_ops)); fe->tuner_priv = NULL; kfree(dev);