From patchwork Mon Oct 30 21:36:44 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: 10033283 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 6F8EA600C5 for ; Mon, 30 Oct 2017 21:37:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62B6828672 for ; Mon, 30 Oct 2017 21:37:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57B7E28981; Mon, 30 Oct 2017 21:37:11 +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 EE84B28672 for ; Mon, 30 Oct 2017 21:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933232AbdJ3Vgz (ORCPT ); Mon, 30 Oct 2017 17:36:55 -0400 Received: from mout.web.de ([212.227.17.12]:54467 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933209AbdJ3Vgx (ORCPT ); Mon, 30 Oct 2017 17:36:53 -0400 Received: from [192.168.1.3] ([92.228.21.111]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M73SD-1dCdCm3JVV-00wnrz; Mon, 30 Oct 2017 22:36:49 +0100 Subject: [PATCH 2/2] max8997_charger: Improve a size determination in max8997_battery_probe() From: SF Markus Elfring To: linux-pm@vger.kernel.org, Sebastian Reichel Cc: LKML , kernel-janitors@vger.kernel.org References: <286b1fea-ccff-5fed-5e2d-fc3b0064cd4d@users.sourceforge.net> Message-ID: <47b1573e-6f12-6949-e330-7dbe7a39c60c@users.sourceforge.net> Date: Mon, 30 Oct 2017 22:36:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <286b1fea-ccff-5fed-5e2d-fc3b0064cd4d@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:NHaZKiutzVvQk6z9am4nx2szIPIq0X5h1+SB/ba8WWq07Hd82JF pFrap1b8EZY7/0rH5wan6rKZfOUGSAP0KpOen15JkI8vvOV37go9Rj+MLp4K1Sd/YEKzYtA 5mQAXyFD8W3WbJM6GbFxJrBBDXSgIjBBcMuoq+pAQHdxJ01yvtp+SlPWB7W2TOaQYd22AE7 4P8e8a5phUO/TT43G1iUg== X-UI-Out-Filterresults: notjunk:1; V01:K0:eQ9cuEecqds=:KLgNM4QU/cO6ct54yuaMUr gxaEecHFMoqLePueNI3nM20ZhX9euEfqlXp6ClBjO+uSiKXZkE7vGo8IjT5BrUFkUuUOUJTb+ HbV4CUIcu9BpqHgkoTgHFaTHhozlOvBX0uNzcQprjmRDZhZcnSCGidBzEgx3jCx1As/+Y/EkE NUvyRV3rnPq8mLrHWABV6P9j2A7z+3NT2m3NOGdY1uXMhhZvGA4kLWL4Lv1F1emvQTInMPBmX l7xLvxciSGaTmjPbhC7+IISXxf9HAU9kSeRuut9mVs5zvk052eX5z2AZeTmu2E1TZB6WqxTKj cwpQU4HUuia2QbQ4hq83Li4Ay28iGBQtTP5hSmsrTuZQq1eHpDT+khUO/ylhAbV1tmcmdw/6Q cBdM05RSoj0pimNRrJ495GIHnnZ81C7Udi7wZccTKokE5W54oeRXAGj7pNK7g3cXogbAgGfEk fZi+VPnDweLHeOvCgS1mJvLZvq1s5BuBfB7Hyt2oM7kxaoeJErDNJxYE9Hb3qHgW+lIsUW3az iTogLpix+immKnL6XTldSxrpICdz5XVZgHITggkmBGcBq/2Vm7dUSn2e0zOTpX7USfBDhwVxL AA1AVWPEFHijmrU7Od5iDBqUhnYgGrkXiyr0a0iBgp16H0COZtCjVqT5VAg92t2YNil5XicYM xZpGyj9LztxuR6rCFiIVGSAS0L1doPHazy9YzmjGDxaAjH2SnP6zPN/fHe26HvsvD5Gg+PTYl z2ru5aISNwbYjpeyiqRLwGe35FUHRz+sGMQH8yDYVpvZoxSKFwerti8PW4dbbsFNyzAyDMrdD zY2KCk9qjuwwFqsaNfsF6MAHuy27LDke1DqjXqUEYGLew3eWbk= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 30 Oct 2017 22:22:54 +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 --- drivers/power/supply/max8997_charger.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/power/supply/max8997_charger.c b/drivers/power/supply/max8997_charger.c index 38a01706a56b..1de0e74b7dea 100644 --- a/drivers/power/supply/max8997_charger.c +++ b/drivers/power/supply/max8997_charger.c @@ -142,8 +142,7 @@ static int max8997_battery_probe(struct platform_device *pdev) if (ret < 0) goto report_bus_failure; - charger = devm_kzalloc(&pdev->dev, sizeof(struct charger_data), - GFP_KERNEL); + charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); if (!charger) return -ENOMEM;