hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/mtd/lpddr/qinfo_probe.c
....@@ -1,22 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Probing flash chips with QINFO records.
34 * (C) 2008 Korolev Alexey <akorolev@infradead.org>
45 * (C) 2008 Vasiliy Leonenko <vasiliy.leonenko@gmail.com>
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version 2
9
- * of the License, or (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
- * 02110-1301, USA.
206 */
217 #include <linux/module.h>
228 #include <linux/types.h>
....@@ -181,8 +167,8 @@
181167 lpddr.numchips = 1;
182168
183169 numvirtchips = lpddr.numchips * lpddr.qinfo->HWPartsNum;
184
- retlpddr = kzalloc(sizeof(struct lpddr_private) +
185
- numvirtchips * sizeof(struct flchip), GFP_KERNEL);
170
+ retlpddr = kzalloc(struct_size(retlpddr, chips, numvirtchips),
171
+ GFP_KERNEL);
186172 if (!retlpddr)
187173 return NULL;
188174