Commit 94700741 authored by Luca Weiss's avatar Luca Weiss Committed by Bjorn Andersson

soc: qcom: rmtfs: fix error handling reading qcom,vmid

of_property_count_u32_elems returns a negative integer when an error
happens , but since the value was assigned to an unsigned integer, the
check never worked correctly. Also print the correct variable in the
error print, ret isn't used here.

Fixes: e656cd0b ("soc: qcom: rmtfs: Optionally map RMTFS to more VMs")
Signed-off-by: default avatarLuca Weiss <luca@z3ntu.xyz>
Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230305-rmtfs-vmid-fix-v1-1-6a7206081602@z3ntu.xyz
parent 77bf4b3e
...@@ -176,7 +176,8 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) ...@@ -176,7 +176,8 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
struct reserved_mem *rmem; struct reserved_mem *rmem;
struct qcom_rmtfs_mem *rmtfs_mem; struct qcom_rmtfs_mem *rmtfs_mem;
u32 client_id; u32 client_id;
u32 num_vmids, vmid[NUM_MAX_VMIDS]; u32 vmid[NUM_MAX_VMIDS];
int num_vmids;
int ret, i; int ret, i;
rmem = of_reserved_mem_lookup(node); rmem = of_reserved_mem_lookup(node);
...@@ -229,7 +230,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) ...@@ -229,7 +230,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
num_vmids = of_property_count_u32_elems(node, "qcom,vmid"); num_vmids = of_property_count_u32_elems(node, "qcom,vmid");
if (num_vmids < 0) { if (num_vmids < 0) {
dev_err(&pdev->dev, "failed to count qcom,vmid elements: %d\n", ret); dev_err(&pdev->dev, "failed to count qcom,vmid elements: %d\n", num_vmids);
goto remove_cdev; goto remove_cdev;
} else if (num_vmids > NUM_MAX_VMIDS) { } else if (num_vmids > NUM_MAX_VMIDS) {
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
......
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