Commit da042eb4 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Sudeep Holla

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: 507cd4d2 ("firmware: arm_scmi: Add compatibility checks for shmem node")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: default avatarCristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20230719061652.8850-1-krzysztof.kozlowski@linaro.orgSigned-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
parent 81b233b8
...@@ -166,8 +166,10 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, ...@@ -166,8 +166,10 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
return -ENOMEM; return -ENOMEM;
shmem = of_parse_phandle(cdev->of_node, "shmem", idx); shmem = of_parse_phandle(cdev->of_node, "shmem", idx);
if (!of_device_is_compatible(shmem, "arm,scmi-shmem")) if (!of_device_is_compatible(shmem, "arm,scmi-shmem")) {
of_node_put(shmem);
return -ENXIO; return -ENXIO;
}
ret = of_address_to_resource(shmem, 0, &res); ret = of_address_to_resource(shmem, 0, &res);
of_node_put(shmem); of_node_put(shmem);
......
...@@ -137,8 +137,10 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, ...@@ -137,8 +137,10 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
return -ENOMEM; return -ENOMEM;
np = of_parse_phandle(cdev->of_node, "shmem", 0); np = of_parse_phandle(cdev->of_node, "shmem", 0);
if (!of_device_is_compatible(np, "arm,scmi-shmem")) if (!of_device_is_compatible(np, "arm,scmi-shmem")) {
of_node_put(np);
return -ENXIO; return -ENXIO;
}
ret = of_address_to_resource(np, 0, &res); ret = of_address_to_resource(np, 0, &res);
of_node_put(np); of_node_put(np);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment