| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2015 Hisilicon Limited, All Rights Reserved. |
|---|
| 3 | 4 | * Author: Jun Ma <majun258@huawei.com> |
|---|
| 4 | 5 | * 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/>. |
|---|
| 17 | 6 | */ |
|---|
| 18 | 7 | |
|---|
| 19 | 8 | #include <linux/acpi.h> |
|---|
| .. | .. |
|---|
| 258 | 247 | |
|---|
| 259 | 248 | parent = platform_bus_type.dev_root; |
|---|
| 260 | 249 | child = of_platform_device_create(np, NULL, parent); |
|---|
| 261 | | - if (!child) |
|---|
| 250 | + if (!child) { |
|---|
| 251 | + of_node_put(np); |
|---|
| 262 | 252 | return -ENOMEM; |
|---|
| 253 | + } |
|---|
| 263 | 254 | |
|---|
| 264 | 255 | if (of_property_read_u32(child->dev.of_node, "num-pins", |
|---|
| 265 | 256 | &num_pins) < 0) { |
|---|
| 266 | 257 | dev_err(&pdev->dev, "No num-pins property\n"); |
|---|
| 258 | + of_node_put(np); |
|---|
| 267 | 259 | return -EINVAL; |
|---|
| 268 | 260 | } |
|---|
| 269 | 261 | |
|---|
| .. | .. |
|---|
| 271 | 263 | mbigen_write_msg, |
|---|
| 272 | 264 | &mbigen_domain_ops, |
|---|
| 273 | 265 | mgn_chip); |
|---|
| 274 | | - if (!domain) |
|---|
| 266 | + if (!domain) { |
|---|
| 267 | + of_node_put(np); |
|---|
| 275 | 268 | return -ENOMEM; |
|---|
| 269 | + } |
|---|
| 276 | 270 | } |
|---|
| 277 | 271 | |
|---|
| 278 | 272 | return 0; |
|---|
| .. | .. |
|---|
| 361 | 355 | err = -EINVAL; |
|---|
| 362 | 356 | |
|---|
| 363 | 357 | 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"); |
|---|
| 366 | 359 | return err; |
|---|
| 367 | 360 | } |
|---|
| 368 | 361 | |
|---|