.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2015, Sony Mobile Communications Inc. |
---|
3 | 4 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
---|
4 | | - * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify |
---|
6 | | - * it under the terms of the GNU General Public License version 2 and |
---|
7 | | - * only version 2 as published by the Free Software Foundation. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | - * GNU General Public License for more details. |
---|
13 | 5 | */ |
---|
14 | 6 | |
---|
15 | 7 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
367 | 359 | return 0; |
---|
368 | 360 | |
---|
369 | 361 | host->ipc_regmap = syscon_node_to_regmap(syscon); |
---|
| 362 | + of_node_put(syscon); |
---|
370 | 363 | if (IS_ERR(host->ipc_regmap)) |
---|
371 | 364 | return PTR_ERR(host->ipc_regmap); |
---|
372 | 365 | |
---|
.. | .. |
---|
518 | 511 | for (id = 0; id < smsm->num_hosts; id++) { |
---|
519 | 512 | ret = smsm_parse_ipc(smsm, id); |
---|
520 | 513 | if (ret < 0) |
---|
521 | | - return ret; |
---|
| 514 | + goto out_put; |
---|
522 | 515 | } |
---|
523 | 516 | |
---|
524 | 517 | /* Acquire the main SMSM state vector */ |
---|
.. | .. |
---|
526 | 519 | smsm->num_entries * sizeof(u32)); |
---|
527 | 520 | if (ret < 0 && ret != -EEXIST) { |
---|
528 | 521 | dev_err(&pdev->dev, "unable to allocate shared state entry\n"); |
---|
529 | | - return ret; |
---|
| 522 | + goto out_put; |
---|
530 | 523 | } |
---|
531 | 524 | |
---|
532 | 525 | states = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SHARED_STATE, NULL); |
---|
533 | 526 | if (IS_ERR(states)) { |
---|
534 | 527 | dev_err(&pdev->dev, "Unable to acquire shared state entry\n"); |
---|
535 | | - return PTR_ERR(states); |
---|
| 528 | + ret = PTR_ERR(states); |
---|
| 529 | + goto out_put; |
---|
536 | 530 | } |
---|
537 | 531 | |
---|
538 | 532 | /* Acquire the list of interrupt mask vectors */ |
---|
.. | .. |
---|
540 | 534 | ret = qcom_smem_alloc(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, size); |
---|
541 | 535 | if (ret < 0 && ret != -EEXIST) { |
---|
542 | 536 | dev_err(&pdev->dev, "unable to allocate smsm interrupt mask\n"); |
---|
543 | | - return ret; |
---|
| 537 | + goto out_put; |
---|
544 | 538 | } |
---|
545 | 539 | |
---|
546 | 540 | intr_mask = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, NULL); |
---|
547 | 541 | if (IS_ERR(intr_mask)) { |
---|
548 | 542 | dev_err(&pdev->dev, "unable to acquire shared memory interrupt mask\n"); |
---|
549 | | - return PTR_ERR(intr_mask); |
---|
| 543 | + ret = PTR_ERR(intr_mask); |
---|
| 544 | + goto out_put; |
---|
550 | 545 | } |
---|
551 | 546 | |
---|
552 | 547 | /* Setup the reference to the local state bits */ |
---|
.. | .. |
---|
557 | 552 | smsm->state = qcom_smem_state_register(local_node, &smsm_state_ops, smsm); |
---|
558 | 553 | if (IS_ERR(smsm->state)) { |
---|
559 | 554 | dev_err(smsm->dev, "failed to register qcom_smem_state\n"); |
---|
560 | | - return PTR_ERR(smsm->state); |
---|
| 555 | + ret = PTR_ERR(smsm->state); |
---|
| 556 | + goto out_put; |
---|
561 | 557 | } |
---|
562 | 558 | |
---|
563 | 559 | /* Register handlers for remote processor entries of interest. */ |
---|
.. | .. |
---|
587 | 583 | } |
---|
588 | 584 | |
---|
589 | 585 | platform_set_drvdata(pdev, smsm); |
---|
| 586 | + of_node_put(local_node); |
---|
590 | 587 | |
---|
591 | 588 | return 0; |
---|
592 | 589 | |
---|
593 | 590 | unwind_interfaces: |
---|
| 591 | + of_node_put(node); |
---|
594 | 592 | for (id = 0; id < smsm->num_entries; id++) |
---|
595 | 593 | if (smsm->entries[id].domain) |
---|
596 | 594 | irq_domain_remove(smsm->entries[id].domain); |
---|
597 | 595 | |
---|
598 | 596 | qcom_smem_state_unregister(smsm->state); |
---|
599 | | - |
---|
| 597 | +out_put: |
---|
| 598 | + of_node_put(local_node); |
---|
600 | 599 | return ret; |
---|
601 | 600 | } |
---|
602 | 601 | |
---|