From patchwork Sun Jan 7 18:34:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10148455 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 438A8601A1 for ; Sun, 7 Jan 2018 18:35:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37A40287F3 for ; Sun, 7 Jan 2018 18:35:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2ABAC28854; Sun, 7 Jan 2018 18:35:17 +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 C5CB2287F3 for ; Sun, 7 Jan 2018 18:35:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754501AbeAGSfD (ORCPT ); Sun, 7 Jan 2018 13:35:03 -0500 Received: from mout.web.de ([212.227.15.4]:55401 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754469AbeAGSfB (ORCPT ); Sun, 7 Jan 2018 13:35:01 -0500 Received: from [192.168.1.3] ([78.48.134.178]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lp7HY-1f4JLX38y4-00etDe; Sun, 07 Jan 2018 19:34:47 +0100 Subject: [PATCH v2] video: ssd1307fb: Improve a size determination in ssd1307fb_probe() To: Arnd Bergmann , Bartlomiej Zolnierkiewicz , Bastian Stender , Jyri Sarha , Tomi Valkeinen , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: LKML , kernel-janitors@vger.kernel.org References: <9433118e-4c2b-db31-7064-df692a99c1b2@users.sourceforge.net> <2091464.qzRHS0Wsad@amdc3058> From: SF Markus Elfring Message-ID: Date: Sun, 7 Jan 2018 19:34:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <2091464.qzRHS0Wsad@amdc3058> Content-Language: en-GB X-Provags-ID: V03:K0:6wCwJ7vGZa/4a0iXHxPojq+08GjBkMYc8WjOkeXc/kj5Cbn/65r edoXFX2AT3fz/mBYBETB3XzHqFOmMbu+oWKBOJTaTJpx45KIXwAdJkC7Nlte7DJia0wtP1N GVD0NaLZ9mG5JQhUUv4NBiLW55jGNSJpiii/B4VTlGvMedUTlQP5L5wwvWfkIyIkiccB9NR 2NDysSKTCOwpmxxlQWr4w== X-UI-Out-Filterresults: notjunk:1; V01:K0:3jv1yNH0yxs=:syNP6AefHF09CKlvmKb1+U 5uff+ZLTowRaSK44Ky2sMWzRbBx+vMWwMfSD1AwDdik4RQ7hnmMLESPUiNqu5IvABgzAzGK3/ ma7ZlPo45f+V3doiEIxdxUVQNOiHkqSbmya13Lrcd9NezjBESs3OK51PwcwMhdtW0oVa19oXr ShdUaFHRM4W5ARUoBIyYBws4WW837UWzZnj8seRgfCGq/XGTFUqCkj2C7kSQkKzqtk88YV5af 2rm7ziOsaxy5+QBYElUByb6/LOqmHxeGw5w/1j7kgxIBMYhfjSj5Gi8jahRP1PYXomUd/aE4G gBnWfkXLqPtXCM1BHwFS2EeYcu06SbyNWSj8KyJHIrjHkKeh4GsCi0TQ0mznQWeZRgSIM8Pxo kTX5CapDhUex1P9gWAaHVPdDAU78p74YeDWnv3M4GkK5XAreQqMPi6A+WGQbbE9v8yg0UuCZN IcgpFMlxf0KMHmNTK53mRF5v4cgePn9OshLGd+HCPHzPxrDO3R1zLheOaAlSaNRoAs9MMzKTb AEwPoUhJN5kCrFjr9Pd+qajYfu0RrSIitqGaRVgJz68yQkerFEMwSlhCS0kNjLh7F3c6G+I8x 6ZCw+04DzyZ3TbR9eUPRJLjIQ6NuVIGZS0kHaW7ZZ4nhZvYBz+mBnJsyQFfpvscRnkcvAlrCU /w6IcAlfSWbJfqwXA1J/MlbXXny6s7rpsVZvhuGypvsCQpAvHRTi/bSS0WUFM77bPG/FNKOiI 74zIK+4iswE2IdSOQRTVAwTyDd4dziDAO6eBuButDAIlil5cBHguYwf8nBl8UvmdI4esaxBas t6/ZghmCsM9XP/7jBXoB/MJW+2vZc69rW6I5AU2UsSa6Q2lbRo= Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 7 Jan 2018 19:27:28 +0100 Replace the specification of a data structure by a pointer dereference 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 --- v2: This update suggestion was rebased on source files from the software "Linux next-20180105". drivers/video/fbdev/ssd1307fb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index f599520374dd..6439231f2db2 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -628,7 +628,8 @@ static int ssd1307fb_probe(struct i2c_client *client, goto fb_alloc_error; } - ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(struct fb_deferred_io), GFP_KERNEL); + ssd1307fb_defio = devm_kzalloc(&client->dev, sizeof(*ssd1307fb_defio), + GFP_KERNEL); if (!ssd1307fb_defio) { dev_err(&client->dev, "Couldn't allocate deferred io.\n"); ret = -ENOMEM;