hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/char/hpet.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Intel & MS High Precision Event Timer Implementation.
34 *
....@@ -5,10 +6,6 @@
56 * Venki Pallipadi
67 * (c) Copyright 2004 Hewlett-Packard Development Company, L.P.
78 * Bob Picco <robert.picco@hp.com>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
129 */
1310
1411 #include <linux/interrupt.h>
....@@ -113,7 +110,7 @@
113110 unsigned long hp_delta;
114111 unsigned int hp_ntimer;
115112 unsigned int hp_which;
116
- struct hpet_dev hp_dev[1];
113
+ struct hpet_dev hp_dev[];
117114 };
118115
119116 static struct hpets *hpets;
....@@ -841,7 +838,6 @@
841838 struct hpet_dev *devp;
842839 u32 i, ntimer;
843840 struct hpets *hpetp;
844
- size_t siz;
845841 struct hpet __iomem *hpet;
846842 static struct hpets *last;
847843 unsigned long period;
....@@ -859,10 +855,8 @@
859855 return 0;
860856 }
861857
862
- siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) *
863
- sizeof(struct hpet_dev));
864
-
865
- hpetp = kzalloc(siz, GFP_KERNEL);
858
+ hpetp = kzalloc(struct_size(hpetp, hp_dev, hdp->hd_nirqs),
859
+ GFP_KERNEL);
866860
867861 if (!hpetp)
868862 return -ENOMEM;