hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/irqchip/irq-mbigen.c
....@@ -1,19 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2015 Hisilicon Limited, All Rights Reserved.
34 * Author: Jun Ma <majun258@huawei.com>
45 * Author: Yun Wu <wuyun.wu@huawei.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
176 */
187
198 #include <linux/acpi.h>
....@@ -258,12 +247,15 @@
258247
259248 parent = platform_bus_type.dev_root;
260249 child = of_platform_device_create(np, NULL, parent);
261
- if (!child)
250
+ if (!child) {
251
+ of_node_put(np);
262252 return -ENOMEM;
253
+ }
263254
264255 if (of_property_read_u32(child->dev.of_node, "num-pins",
265256 &num_pins) < 0) {
266257 dev_err(&pdev->dev, "No num-pins property\n");
258
+ of_node_put(np);
267259 return -EINVAL;
268260 }
269261
....@@ -271,8 +263,10 @@
271263 mbigen_write_msg,
272264 &mbigen_domain_ops,
273265 mgn_chip);
274
- if (!domain)
266
+ if (!domain) {
267
+ of_node_put(np);
275268 return -ENOMEM;
269
+ }
276270 }
277271
278272 return 0;
....@@ -361,8 +355,7 @@
361355 err = -EINVAL;
362356
363357 if (err) {
364
- dev_err(&pdev->dev, "Failed to create mbi-gen@%p irqdomain",
365
- mgn_chip->base);
358
+ dev_err(&pdev->dev, "Failed to create mbi-gen irqdomain\n");
366359 return err;
367360 }
368361