[v2,3/3] fpga: socfpga-a10: Fix incorrect return value of devm_regmap_init_mmio

Message ID 20230710133830.65631-3-frank.li@vivo.com
State New
Headers
Series [v2,1/3] fpga: fpga-mgr: altera-pr-ip: Convert to devm_platform_ioremap_resource() |

Commit Message

李扬韬 July 10, 2023, 1:38 p.m. UTC
  When devm_regmap_init_mmio fails, we should return PTR_ERR(priv->regmap)
instead of -ENODEV.

Fixes: acbb910ae04b ("fpga-manager: Add Socfpga Arria10 support")
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/fpga/socfpga-a10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Greg KH July 10, 2023, 2:11 p.m. UTC | #1
On Mon, Jul 10, 2023 at 09:38:30PM +0800, Yangtao Li wrote:
> When devm_regmap_init_mmio fails, we should return PTR_ERR(priv->regmap)
> instead of -ENODEV.
> 
> Fixes: acbb910ae04b ("fpga-manager: Add Socfpga Arria10 support")

Why are you not also including a cc: stable@ tag here?

thanks,

greg k-h
  
Xu Yilun July 12, 2023, 1:42 a.m. UTC | #2
On 2023-07-10 at 16:11:35 +0200, Greg Kroah-Hartman wrote:
> On Mon, Jul 10, 2023 at 09:38:30PM +0800, Yangtao Li wrote:
> > When devm_regmap_init_mmio fails, we should return PTR_ERR(priv->regmap)
> > instead of -ENODEV.
> > 
> > Fixes: acbb910ae04b ("fpga-manager: Add Socfpga Arria10 support")
> 
> Why are you not also including a cc: stable@ tag here?

The change is to propagate the error number produced by regmap, instead
of using a fixed error number.

I think this is more of an improvement, not a bug fix. So no need to
merge to stable? And the changelog should be improved to avoid
confusing.

Thanks,
Yilun

> 
> thanks,
> 
> greg k-h
  

Patch

diff --git a/drivers/fpga/socfpga-a10.c b/drivers/fpga/socfpga-a10.c
index cc4861e345c9..b7b6e0bdb3d9 100644
--- a/drivers/fpga/socfpga-a10.c
+++ b/drivers/fpga/socfpga-a10.c
@@ -491,7 +491,7 @@  static int socfpga_a10_fpga_probe(struct platform_device *pdev)
 	priv->regmap = devm_regmap_init_mmio(dev, reg_base,
 					     &socfpga_a10_fpga_regmap_config);
 	if (IS_ERR(priv->regmap))
-		return -ENODEV;
+		return PTR_ERR(priv->regmap);
 
 	priv->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(priv->clk)) {