hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/irqchip/qcom-irq-combiner.c
....@@ -1,13 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
2
- *
3
- * This program is free software; you can redistribute it and/or modify
4
- * it under the terms of the GNU General Public License version 2 and
5
- * only version 2 as published by the Free Software Foundation.
6
- *
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU General Public License for more details.
113 */
124
135 /*
....@@ -41,7 +33,7 @@
4133 int parent_irq;
4234 u32 nirqs;
4335 u32 nregs;
44
- struct combiner_reg regs[0];
36
+ struct combiner_reg regs[];
4537 };
4638
4739 static inline int irq_nr(u32 reg, u32 bit)
....@@ -237,7 +229,6 @@
237229 static int __init combiner_probe(struct platform_device *pdev)
238230 {
239231 struct combiner *combiner;
240
- size_t alloc_sz;
241232 int nregs;
242233 int err;
243234
....@@ -247,8 +238,8 @@
247238 return -EINVAL;
248239 }
249240
250
- alloc_sz = sizeof(*combiner) + sizeof(struct combiner_reg) * nregs;
251
- combiner = devm_kzalloc(&pdev->dev, alloc_sz, GFP_KERNEL);
241
+ combiner = devm_kzalloc(&pdev->dev, struct_size(combiner, regs, nregs),
242
+ GFP_KERNEL);
252243 if (!combiner)
253244 return -ENOMEM;
254245
....@@ -257,10 +248,8 @@
257248 return err;
258249
259250 combiner->parent_irq = platform_get_irq(pdev, 0);
260
- if (combiner->parent_irq <= 0) {
261
- dev_err(&pdev->dev, "Error getting IRQ resource\n");
251
+ if (combiner->parent_irq <= 0)
262252 return -EPROBE_DEFER;
263
- }
264253
265254 combiner->domain = irq_domain_create_linear(pdev->dev.fwnode, combiner->nirqs,
266255 &domain_ops, combiner);