[PATCH 3/3] soc: qcom: ocmem: return -EPROBE_DEFER is ocmem is not available

Dmitry Baryshkov posted 3 patches 1 week, 4 days ago
There is a newer version of this series
[PATCH 3/3] soc: qcom: ocmem: return -EPROBE_DEFER is ocmem is not available
Posted by Dmitry Baryshkov 1 week, 4 days ago
If OCMEM is declared in DT, it is expected that it is present and
handled by the driver. The GPU driver will ignore -ENODEV error, which
typically means that OCMEM isn't defined in DT. Let ocmem return
-EPROBE_DEFER if it supposed to be used, but it is not probed (yet).

Fixes: 88c1e9404f1d ("soc: qcom: add OCMEM driver")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 drivers/soc/qcom/ocmem.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c
index d57baa9cfa03..c35a98984acc 100644
--- a/drivers/soc/qcom/ocmem.c
+++ b/drivers/soc/qcom/ocmem.c
@@ -203,10 +203,9 @@ struct ocmem *of_get_ocmem(struct device *dev)
 
 	ocmem = platform_get_drvdata(pdev);
 	put_device(&pdev->dev);
-	if (!ocmem) {
-		dev_err(dev, "Cannot get ocmem\n");
-		return ERR_PTR(-ENODEV);
-	}
+	if (!ocmem)
+		return ERR_PTR(dev_err_probe(dev, -EPROBE_DEFER, "Cannot get ocmem\n"));
+
 	return ocmem;
 }
 EXPORT_SYMBOL_GPL(of_get_ocmem);

-- 
2.47.3
Re: [PATCH 3/3] soc: qcom: ocmem: return -EPROBE_DEFER is ocmem is not available
Posted by Konrad Dybcio 1 week, 4 days ago
On 3/23/26 2:20 AM, Dmitry Baryshkov wrote:
> If OCMEM is declared in DT, it is expected that it is present and
> handled by the driver. The GPU driver will ignore -ENODEV error, which
> typically means that OCMEM isn't defined in DT. Let ocmem return
> -EPROBE_DEFER if it supposed to be used, but it is not probed (yet).
> 
> Fixes: 88c1e9404f1d ("soc: qcom: add OCMEM driver")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>  drivers/soc/qcom/ocmem.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c
> index d57baa9cfa03..c35a98984acc 100644
> --- a/drivers/soc/qcom/ocmem.c
> +++ b/drivers/soc/qcom/ocmem.c
> @@ -203,10 +203,9 @@ struct ocmem *of_get_ocmem(struct device *dev)
>  
>  	ocmem = platform_get_drvdata(pdev);
>  	put_device(&pdev->dev);
> -	if (!ocmem) {
> -		dev_err(dev, "Cannot get ocmem\n");
> -		return ERR_PTR(-ENODEV);
> -	}
> +	if (!ocmem)
> +		return ERR_PTR(dev_err_probe(dev, -EPROBE_DEFER, "Cannot get ocmem\n"));

dev_err_ptr_probe()

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad