Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752655AbeANUnp (ORCPT + 1 other); Sun, 14 Jan 2018 15:43:45 -0500 Received: from mout.web.de ([212.227.17.11]:62834 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751131AbeANUno (ORCPT ); Sun, 14 Jan 2018 15:43:44 -0500 Subject: [PATCH 2/3] mfd/abx500-core: Improve two size determinations in abx500_register_ops() From: SF Markus Elfring To: linux-arm-kernel@lists.infradead.org, Lee Jones , Linus Walleij Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <777a907c-49b6-287f-3ce6-a31ae1b84abd@users.sourceforge.net> Date: Sun, 14 Jan 2018 21:43:27 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:PB+TVgiPtfyZF8yTa1D1D6tEK6+mIxiyVQp3EiAwx2SwHGvA6Y4 yl5AaTFdJlpWC1PkGKo8eAv5bLpy5/f/RyAD+YKQmj7uLlnUwAlpHlc//PxGqHE3zJ5ofVQ AcvF0J/bdfIBW0htoi1c00AZOKWO7d8rLqZEXCkiAuD9bEPUfdhDbXXXdm8V/Mt4d+b/VRh UeDbxHfD2v1eaAd2oCERw== X-UI-Out-Filterresults: notjunk:1;V01:K0:Div6kuzj7w0=:DYBVYPZDM6GbOgLfcU+bAB HLGCK49N4D71FllyhJ/NximVo/If24VzS1zmaq3m9dqbCKHLjMh6m/iRQHiyYnTwm5yfotcxM OvFGt9KMqVMMilxMGQ4bPpfv0i0P/K1NTJ8UotdixyQdQKWrMmVieBRzZsAjejakQduZr5bfx jZrcO6gAo2NjW8bkwGgVFejYP1LmHXiiZgKhwFtjljdPB1TbX2106z/RikgiOYb3oURxo9djy ABQJwoHYhbctgqiJ7cNvf95f0BNZ6CvDxWeJ8AtBZvvZF2T4GL6cBlgSUZk7wXZvTLvcO6CJ7 Y8V9VJ82Pzi+VwHDNPGK7+Ncztv4fBhHPhEQ/uzbegBmsuINW0TXFKRDD5WC4APjo6zN0Prax IPOQuYTjN8B4ioMeqBjSSmy393oMkqtVNThmBAXxK2yP10uY3zGfwijWiR8olmPUsxdYzLIxJ HVEjt3fKaMQWnQJ8cuxl5ee6OyOsXXQfL+Si63ShJ+iD5is3jQ7/usB10Du4R7ao0WkWHLJK1 oUf9gsHGjCpkJLS2VH6EdeRKTTzfGsR4ONZWkWj/IkSnSyJuvVHxaSKqQMvUiyVTyvXi6SDOJ UtLErjSSVO3zaU+nb7unB6ohdJG+/rWCtj1yBy8g2fPg2tagF1o0yQrNxuAg1UGrVzsBm4e+5 z0OG8pqIDaLTXdhniBhAju7J0mj9h3z/OHMeARTkzyw+C7zpv8wRoL0yL70Gxrd+WD2PCLtzk 40c5L3G8iHgNhaIi5h0DRlcSapDtr6zydhqSBD3DY6V5ZFS9fmyK5FD+sDX9j1C6Ajclgd+Qr Oq3X7zTnEVaPwstSDzeUCyACR6arKY1A7Gc5TYw8CxfJPc5eDY= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Sun, 14 Jan 2018 21:19:10 +0100 Replace the specification of two 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/mfd/abx500-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c index c8c9d41abcaa..17176e91cbd0 100644 --- a/drivers/mfd/abx500-core.c +++ b/drivers/mfd/abx500-core.c @@ -37,14 +37,12 @@ int abx500_register_ops(struct device *dev, struct abx500_ops *ops) { struct abx500_device_entry *dev_entry; - dev_entry = devm_kzalloc(dev, - sizeof(struct abx500_device_entry), - GFP_KERNEL); + dev_entry = devm_kzalloc(dev, sizeof(*dev_entry), GFP_KERNEL); if (!dev_entry) return -ENOMEM; dev_entry->dev = dev; - memcpy(&dev_entry->ops, ops, sizeof(struct abx500_ops)); + memcpy(&dev_entry->ops, ops, sizeof(*ops)); list_add_tail(&dev_entry->list, &abx500_list); return 0; -- 2.15.1