[PATCH] phy: fix resource_size.cocci warnings

kernel test robot lkp at intel.com
Thu Mar 18 23:28:44 GMT 2021


From: kernel test robot <lkp at intel.com>

drivers/phy/microchip/sparx5_serdes.c:2440:54-57: ERROR: Missing resource_size with iores


 Use resource_size function on resource object
 instead of explicit computation.

Generated by: scripts/coccinelle/api/resource_size.cocci

Fixes: 2ff8a1eeb5aa ("phy: Add Sparx5 ethernet serdes PHY driver")
CC: Steen Hegelund <steen.hegelund at microchip.com>
Reported-by: kernel test robot <lkp at intel.com>
Signed-off-by: kernel test robot <lkp at intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ba5b053ab3ac674b91a6669086139819359a5e6e
commit: 2ff8a1eeb5aa8bb471f3756a695b8b69841eb61f [4647/5413] phy: Add Sparx5 ethernet serdes PHY driver

 sparx5_serdes.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/phy/microchip/sparx5_serdes.c
+++ b/drivers/phy/microchip/sparx5_serdes.c
@@ -2437,7 +2437,7 @@ static int sparx5_serdes_probe(struct pl
 	priv->coreclock = clock;
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	iomem = devm_ioremap(priv->dev, iores->start, iores->end - iores->start + 1);
+	iomem = devm_ioremap(priv->dev, iores->start, resource_size(iores));
 	if (IS_ERR(iomem)) {
 		dev_err(priv->dev, "Unable to get serdes registers: %s\n",
 			iores->name);



More information about the linux-arm-kernel mailing list