# \[PATCH\] phy: fix resource\_size.cocci warnings

- Status: LANDED (cbc336c09b6d · 2021-04-06 05:09)
- Landed in mainline as cbc336c09b6d on 2021-04-06.
- List: linux-phy
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-phy/2021/03/6507039/t

## \[PATCH\] phy: fix resource\_size.cocci warnings

- From: kernel test robot \<hidden\>
- Date: 2021-03-18 23:29:38 
- Message: https://ratatoskr.run/linux-phy/2021/03/6507039.md

```text
From: kernel test robot <redacted>

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@microchip.com>
Reported-by: kernel test robot <redacted>
Signed-off-by: kernel test robot <redacted>
---

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);

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
```

## Re: \[PATCH\] phy: fix resource\_size.cocci warnings

- From: Vinod Koul \<vkoul@kernel.org\>
- Date: 2021-04-06 05:09:36 
- Message: https://ratatoskr.run/linux-phy/2021/04/6507293.md

```text
On 19-03-21, 07:28, kernel test robot wrote:
> From: kernel test robot <redacted>
> 
> 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

Applied, thanks

-- 
~Vinod

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
```
