remoteproc: silence an uninitialized variable warning
Subsystems (3)
PATCH 1/1 remoteproc: silence an uninitialized variable warning
Smatch complains that "ret" might be uninitialized. I can see why it generates the warning, but I don't know if it's actually possible. Anyway initializing "ret" here is harmless.
--- drivers/soc/qcom/mdt_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/mdt_loader.c +1 -1
@@ -188,7 +188,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,if (reloc_base) *reloc_base = mem_reloc; - + ret =0 ; out:kfree (fw_name);
Signature · 1 line
2.17.1
Quoted 14 lines · Dan Carpenter
Smatch complains that "ret" might be uninitialized. I can see why it generates the warning, but I don't know if it's actually possible. Anyway initializing "ret" here is harmless.
Signed-off-by Dan Carpenter <[email protected]>--- drivers/soc/qcom/mdt_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/soc/qcom/mdt_loader.c +0
-0
drivers/soc/qcom/mdt_loader.c static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, · line 191
Quoted 5 lines
drivers/soc/qcom/mdt_loader.c +1
-1@@ -188,7 +188,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,if (reloc_base) *reloc_base = mem_reloc; - + ret =0 ;
You are overriding the value here, better keep it at the start. Thanks,
Mukesh
Quoted 3 lines
drivers/soc/qcom/mdt_loader.c +0
-0out:kfree (fw_name);
Quoted 11 lines · Mukesh Ojha
Quoted 9 lines · Dan Carpenter
Smatch complains that "ret" might be uninitialized. I can see why it generates the warning, but I don't know if it's actually possible. Anyway initializing "ret" here is harmless.
Signed-off-by Dan Carpenter <[email protected]>--- drivers/soc/qcom/mdt_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
drivers/soc/qcom/mdt_loader.c static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, · line 190
Quoted 9 lines
drivers/soc/qcom/mdt_loader.c +1
-1@@ -188,7 +188,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,if (reloc_base) *reloc_base = mem_reloc; - + ret =0 ;You are overriding the value here, better keep it at the start.
I like how I wrote it. It makes it clear that this is the success path.
regards,
dan carpenter
Quoted 22 lines · Dan Carpenter
Quoted 10 lines · Mukesh Ojha
Quoted 9 lines · Dan Carpenter
Smatch complains that "ret" might be uninitialized. I can see why it generates the warning, but I don't know if it's actually possible. Anyway initializing "ret" here is harmless.
Signed-off-by Dan Carpenter <[email protected]>--- drivers/soc/qcom/mdt_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 11 lines
drivers/soc/qcom/mdt_loader.c static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, · line 190
Quoted 9 lines
drivers/soc/qcom/mdt_loader.c +1
-1@@ -188,7 +188,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,if (reloc_base) *reloc_base = mem_reloc; - + ret =0 ;You are overriding the value here, better keep it at the start.
Quoted 1 line
I like how I wrote it. It makes it clear that this is the success path.
But think about a case when this request_firmware_into_buf fails or the snippet above that can set the ret with error value
right.. is not that possible?..and ret = 0 stops propagating the error properly.
Thanks
Mukesh
Quoted 4 lines
regards,
dan carpenter
Quoted 24 lines · Mukesh Ojha
Quoted 22 lines · Dan Carpenter
Quoted 21 lines · Mukesh Ojha
Quoted 14 lines · Dan Carpenter
Smatch complains that "ret" might be uninitialized. I can see why it generates the warning, but I don't know if it's actually possible. Anyway initializing "ret" here is harmless.
Signed-off-by Dan Carpenter <[email protected]>--- drivers/soc/qcom/mdt_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/soc/qcom/mdt_loader.c +0
-0drivers/soc/qcom/mdt_loader.c static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, · line 190
Quoted 4 lines
drivers/soc/qcom/mdt_loader.c +1
-1@@ -188,7 +188,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,if (reloc_base) *reloc_base = mem_reloc; - + ret =0 ;You are overriding the value here, better keep it at the start.
Quoted 9 lines
Quoted 1 line
I like how I wrote it. It makes it clear that this is the success path.
But think about a case when this
request_firmware_into_buffails or the snippet above that can set the ret with error valueright.. is not that possible?..and ret = 0 stops propagating the error properly.
Gar. I read "goto out;" instead of "break;". It probably should be goto out though... Anyway, I will resend.
Thanks!
regards,
dan carpenter