soc: qcom: Fix a IS_ERR() vs NULL bug in probe

Message ID ZH7sgpLAN23bCz9v@moroto
State New
Headers
Series soc: qcom: Fix a IS_ERR() vs NULL bug in probe |

Commit Message

Dan Carpenter June 6, 2023, 8:21 a.m. UTC
  The devm_ioremap() function returns NULL on error, it never returns
error pointers.

Fixes: a77b2a0b1280 ("soc: qcom: Introduce RPM master stats driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/soc/qcom/rpm_master_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Konrad Dybcio June 6, 2023, 9:32 a.m. UTC | #1
On 6.06.2023 10:21, Dan Carpenter wrote:
> The devm_ioremap() function returns NULL on error, it never returns
> error pointers.
> 
> Fixes: a77b2a0b1280 ("soc: qcom: Introduce RPM master stats driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
Thanks!

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  drivers/soc/qcom/rpm_master_stats.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/rpm_master_stats.c b/drivers/soc/qcom/rpm_master_stats.c
> index 6dd98b9f7129..9ca13bcf67d3 100644
> --- a/drivers/soc/qcom/rpm_master_stats.c
> +++ b/drivers/soc/qcom/rpm_master_stats.c
> @@ -105,7 +105,7 @@ static int master_stats_probe(struct platform_device *pdev)
>  		}
>  
>  		data[i].base = devm_ioremap(dev, res.start, resource_size(&res));
> -		if (IS_ERR(data[i].base)) {
> +		if (!data[i].base) {
>  			debugfs_remove_recursive(root);
>  			return dev_err_probe(dev, -EINVAL,
>  					     "Could not map the MSG RAM slice idx %d!\n", i);
  
Bjorn Andersson June 13, 2023, 10:30 p.m. UTC | #2
On Tue, 6 Jun 2023 11:21:22 +0300, Dan Carpenter wrote:
> The devm_ioremap() function returns NULL on error, it never returns
> error pointers.
> 
> 

Applied, thanks!

[1/1] soc: qcom: Fix a IS_ERR() vs NULL bug in probe
      commit: 3aed112953b1877ede66ae77afa4e5a5024be7cb

Best regards,
  

Patch

diff --git a/drivers/soc/qcom/rpm_master_stats.c b/drivers/soc/qcom/rpm_master_stats.c
index 6dd98b9f7129..9ca13bcf67d3 100644
--- a/drivers/soc/qcom/rpm_master_stats.c
+++ b/drivers/soc/qcom/rpm_master_stats.c
@@ -105,7 +105,7 @@  static int master_stats_probe(struct platform_device *pdev)
 		}
 
 		data[i].base = devm_ioremap(dev, res.start, resource_size(&res));
-		if (IS_ERR(data[i].base)) {
+		if (!data[i].base) {
 			debugfs_remove_recursive(root);
 			return dev_err_probe(dev, -EINVAL,
 					     "Could not map the MSG RAM slice idx %d!\n", i);