Skip to content

Commit da042eb

Browse files
krzksudeep-holla
authored andcommitted
firmware: arm_scmi: Drop OF node reference in the transport channel setup
The OF node reference obtained from of_parse_phandle() should be dropped if node is not compatible with arm,scmi-shmem. Fixes: 507cd4d ("firmware: arm_scmi: Add compatibility checks for shmem node") Cc: <stable@vger.kernel.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20230719061652.8850-1-krzysztof.kozlowski@linaro.org Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
1 parent 81b233b commit da042eb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

drivers/firmware/arm_scmi/mailbox.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,10 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
166166
return -ENOMEM;
167167

168168
shmem = of_parse_phandle(cdev->of_node, "shmem", idx);
169-
if (!of_device_is_compatible(shmem, "arm,scmi-shmem"))
169+
if (!of_device_is_compatible(shmem, "arm,scmi-shmem")) {
170+
of_node_put(shmem);
170171
return -ENXIO;
172+
}
171173

172174
ret = of_address_to_resource(shmem, 0, &res);
173175
of_node_put(shmem);

drivers/firmware/arm_scmi/smc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
137137
return -ENOMEM;
138138

139139
np = of_parse_phandle(cdev->of_node, "shmem", 0);
140-
if (!of_device_is_compatible(np, "arm,scmi-shmem"))
140+
if (!of_device_is_compatible(np, "arm,scmi-shmem")) {
141+
of_node_put(np);
141142
return -ENXIO;
143+
}
142144

143145
ret = of_address_to_resource(np, 0, &res);
144146
of_node_put(np);

0 commit comments

Comments
 (0)