From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Subject: [PATCH v2 9/9] ACPI-video: Improve a size determination in four functions Date: Wed, 9 Aug 2017 17:47:21 +0200 Message-ID: <3b229259-6268-9bbd-f960-4ce382b0ab23@users.sourceforge.net> References: <566ABCD9.1060404@users.sourceforge.net> <897ebf36-2fe5-e109-adf6-b81b6e863d9a@users.sourceforge.net> <3e0cdc5b-fd15-515a-82f2-2f44792664ed@users.sourceforge.net> <6882cbb1-3f61-fb64-2972-30c277f28580@users.sourceforge.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org To: linux-acpi@vger.kernel.org, Len Brown , "Rafael J. Wysocki" , Zhang Rui Cc: Hans de Goede , LKML , kernel-janitors@vger.kernel.org List-Id: linux-acpi@vger.kernel.org From: Markus Elfring Date: Wed, 9 Aug 2017 16:45:29 +0200 Replace the specification of a 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/acpi/acpi_video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index 3cc1798676ab..d999f4e49b98 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -1140,7 +1140,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, if (ACPI_FAILURE(status)) return 0; - data = kzalloc(sizeof(struct acpi_video_device), GFP_KERNEL); + data = kzalloc(sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; @@ -1321,7 +1321,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) dod->package.count)); active_list = kcalloc(1 + dod->package.count, - sizeof(struct acpi_video_enumerated_device), + sizeof(*active_list), GFP_KERNEL); if (!active_list) { status = -ENOMEM; @@ -1742,7 +1742,7 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device) pci_dev_put(pdev); } - memset(&props, 0, sizeof(struct backlight_properties)); + memset(&props, 0, sizeof(props)); props.type = BACKLIGHT_FIRMWARE; props.max_brightness = device->brightness->count - ACPI_VIDEO_FIRST_LEVEL - 1; @@ -2007,7 +2007,7 @@ static int acpi_video_bus_add(struct acpi_device *device) return -ENODEV; } - video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); + video = kzalloc(sizeof(*video), GFP_KERNEL); if (!video) return -ENOMEM; -- 2.13.4