Message ID | 1637721384-70836-1-git-send-email-yang.lee@linux.alibaba.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [-next,1/2] tsnep: fix resource_size.cocci warnings | expand |
> adapter->addr = devm_ioremap_resource(&pdev->dev, io); > if (IS_ERR(adapter->addr)) > return PTR_ERR(adapter->addr); > - adapter->size = io->end - io->start + 1; > + adapter->size = resource_size(io); In fact adapter->size can be removed completely, because it is used nowhere. I will submit a patch. Gerhard
diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c index 6a7feb2..c48e8ea 100644 --- a/drivers/net/ethernet/engleder/tsnep_main.c +++ b/drivers/net/ethernet/engleder/tsnep_main.c @@ -1152,7 +1152,7 @@ static int tsnep_probe(struct platform_device *pdev) adapter->addr = devm_ioremap_resource(&pdev->dev, io); if (IS_ERR(adapter->addr)) return PTR_ERR(adapter->addr); - adapter->size = io->end - io->start + 1; + adapter->size = resource_size(io); adapter->irq = platform_get_irq(pdev, 0); netdev->mem_start = io->start; netdev->mem_end = io->end;
Use resource_size function on resource object instead of explicit computation. Clean up coccicheck warning: ./drivers/net/ethernet/engleder/tsnep_main.c:1155:21-24: ERROR: Missing resource_size with io Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> --- drivers/net/ethernet/engleder/tsnep_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)