hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/soc/qcom/smsm.c
....@@ -1,15 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2015, Sony Mobile Communications Inc.
34 * 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.
135 */
146
157 #include <linux/interrupt.h>
....@@ -367,6 +359,7 @@
367359 return 0;
368360
369361 host->ipc_regmap = syscon_node_to_regmap(syscon);
362
+ of_node_put(syscon);
370363 if (IS_ERR(host->ipc_regmap))
371364 return PTR_ERR(host->ipc_regmap);
372365
....@@ -518,7 +511,7 @@
518511 for (id = 0; id < smsm->num_hosts; id++) {
519512 ret = smsm_parse_ipc(smsm, id);
520513 if (ret < 0)
521
- return ret;
514
+ goto out_put;
522515 }
523516
524517 /* Acquire the main SMSM state vector */
....@@ -526,13 +519,14 @@
526519 smsm->num_entries * sizeof(u32));
527520 if (ret < 0 && ret != -EEXIST) {
528521 dev_err(&pdev->dev, "unable to allocate shared state entry\n");
529
- return ret;
522
+ goto out_put;
530523 }
531524
532525 states = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SHARED_STATE, NULL);
533526 if (IS_ERR(states)) {
534527 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;
536530 }
537531
538532 /* Acquire the list of interrupt mask vectors */
....@@ -540,13 +534,14 @@
540534 ret = qcom_smem_alloc(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, size);
541535 if (ret < 0 && ret != -EEXIST) {
542536 dev_err(&pdev->dev, "unable to allocate smsm interrupt mask\n");
543
- return ret;
537
+ goto out_put;
544538 }
545539
546540 intr_mask = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, NULL);
547541 if (IS_ERR(intr_mask)) {
548542 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;
550545 }
551546
552547 /* Setup the reference to the local state bits */
....@@ -557,7 +552,8 @@
557552 smsm->state = qcom_smem_state_register(local_node, &smsm_state_ops, smsm);
558553 if (IS_ERR(smsm->state)) {
559554 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;
561557 }
562558
563559 /* Register handlers for remote processor entries of interest. */
....@@ -587,16 +583,19 @@
587583 }
588584
589585 platform_set_drvdata(pdev, smsm);
586
+ of_node_put(local_node);
590587
591588 return 0;
592589
593590 unwind_interfaces:
591
+ of_node_put(node);
594592 for (id = 0; id < smsm->num_entries; id++)
595593 if (smsm->entries[id].domain)
596594 irq_domain_remove(smsm->entries[id].domain);
597595
598596 qcom_smem_state_unregister(smsm->state);
599
-
597
+out_put:
598
+ of_node_put(local_node);
600599 return ret;
601600 }
602601