summaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorSudeep Holla <sudeep.holla@arm.com>2024-08-27 16:38:37 +0200
committerSudeep Holla <sudeep.holla@arm.com>2024-08-28 18:16:25 +0200
commitccf502193126e168cfca08ec3d8a2460057a0da5 (patch)
tree65862c1f257162f1dd7bbe91ba08be06a39bc5a1 /drivers/firmware
parentfirmware: arm_scmi: Fix trivial whitespace/coding style issues (diff)
downloadlinux-ccf502193126e168cfca08ec3d8a2460057a0da5.tar.xz
linux-ccf502193126e168cfca08ec3d8a2460057a0da5.zip
firmware: arm_scmi: Replace the use of of_node_put() to __free(device_node)
Use __free for device_node values, and thus drop calls to of_node_put. The goal is simplify of_node reference cleanup by using this scope-based of_node_put() cleanup to simplify function exit handling. When using __free a resource is allocated within a block, it is automatically freed at the end of the block. This cleanup aligns well with the recent change in shmem.c to use __free instead of explicit of_node_put() calls. Message-Id: <20240827143838.1465913-3-sudeep.holla@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/arm_scmi/transports/mailbox.c10
-rw-r--r--drivers/firmware/arm_scmi/transports/smc.c5
2 files changed, 6 insertions, 9 deletions
diff --git a/drivers/firmware/arm_scmi/transports/mailbox.c b/drivers/firmware/arm_scmi/transports/mailbox.c
index 9d258f5d5da8..1a754dee24f7 100644
--- a/drivers/firmware/arm_scmi/transports/mailbox.c
+++ b/drivers/firmware/arm_scmi/transports/mailbox.c
@@ -129,18 +129,16 @@ static int mailbox_chan_validate(struct device *cdev, int *a2p_rx_chan,
/* Bail out if provided shmem descriptors do not refer distinct areas */
if (num_sh > 1) {
- struct device_node *np_tx, *np_rx;
+ struct device_node *np_tx __free(device_node) =
+ of_parse_phandle(np, "shmem", 0);
+ struct device_node *np_rx __free(device_node) =
+ of_parse_phandle(np, "shmem", 1);
- np_tx = of_parse_phandle(np, "shmem", 0);
- np_rx = of_parse_phandle(np, "shmem", 1);
if (!np_tx || !np_rx || np_tx == np_rx) {
dev_warn(cdev, "Invalid shmem descriptor for '%s'\n",
of_node_full_name(np));
ret = -EINVAL;
}
-
- of_node_put(np_tx);
- of_node_put(np_rx);
}
/* Calculate channels IDs to use depending on mboxes/shmem layout */
diff --git a/drivers/firmware/arm_scmi/transports/smc.c b/drivers/firmware/arm_scmi/transports/smc.c
index 2ffed5280eab..f8dd108777f9 100644
--- a/drivers/firmware/arm_scmi/transports/smc.c
+++ b/drivers/firmware/arm_scmi/transports/smc.c
@@ -84,12 +84,11 @@ static irqreturn_t smc_msg_done_isr(int irq, void *data)
static bool smc_chan_available(struct device_node *of_node, int idx)
{
- struct device_node *np = of_parse_phandle(of_node, "shmem", 0);
-
+ struct device_node *np __free(device_node) =
+ of_parse_phandle(of_node, "shmem", 0);
if (!np)
return false;
- of_node_put(np);
return true;
}