LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -next 1/2] tsnep: fix resource_size.cocci warnings
@ 2021-11-24  2:36 Yang Li
  2021-11-24  2:36 ` [PATCH -next 2/2] tsnep: fix platform_no_drv_owner.cocci warning Yang Li
  2021-11-24 20:28 ` [PATCH -next 1/2] tsnep: fix resource_size.cocci warnings Gerhard Engleder
  0 siblings, 2 replies; 5+ messages in thread
From: Yang Li @ 2021-11-24  2:36 UTC (permalink / raw)
  To: davem; +Cc: kuba, netdev, linux-kernel, Yang Li

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

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH -next 2/2] tsnep: fix platform_no_drv_owner.cocci warning
  2021-11-24  2:36 [PATCH -next 1/2] tsnep: fix resource_size.cocci warnings Yang Li
@ 2021-11-24  2:36 ` Yang Li
  2021-11-24 20:32   ` Gerhard Engleder
  2021-11-24 20:28 ` [PATCH -next 1/2] tsnep: fix resource_size.cocci warnings Gerhard Engleder
  1 sibling, 1 reply; 5+ messages in thread
From: Yang Li @ 2021-11-24  2:36 UTC (permalink / raw)
  To: davem; +Cc: kuba, netdev, linux-kernel, Yang Li

Remove .owner field if calls are used which set it automatically

Eliminate the following coccicheck warning:
./drivers/net/ethernet/engleder/tsnep_main.c:1263:3-8: No need to set
.owner here. The core will do it.

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 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
index c48e8ea..3d0408e 100644
--- a/drivers/net/ethernet/engleder/tsnep_main.c
+++ b/drivers/net/ethernet/engleder/tsnep_main.c
@@ -1260,7 +1260,6 @@ static int tsnep_remove(struct platform_device *pdev)
 static struct platform_driver tsnep_driver = {
 	.driver = {
 		.name = TSNEP,
-		.owner = THIS_MODULE,
 		.of_match_table = of_match_ptr(tsnep_of_match),
 	},
 	.probe = tsnep_probe,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 1/2] tsnep: fix resource_size.cocci warnings
  2021-11-24  2:36 [PATCH -next 1/2] tsnep: fix resource_size.cocci warnings Yang Li
  2021-11-24  2:36 ` [PATCH -next 2/2] tsnep: fix platform_no_drv_owner.cocci warning Yang Li
@ 2021-11-24 20:28 ` Gerhard Engleder
  1 sibling, 0 replies; 5+ messages in thread
From: Gerhard Engleder @ 2021-11-24 20:28 UTC (permalink / raw)
  To: Yang Li; +Cc: David Miller, Jakub Kicinski, netdev, linux-kernel

>         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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 2/2] tsnep: fix platform_no_drv_owner.cocci warning
  2021-11-24  2:36 ` [PATCH -next 2/2] tsnep: fix platform_no_drv_owner.cocci warning Yang Li
@ 2021-11-24 20:32   ` Gerhard Engleder
  2021-11-25  2:11     ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Gerhard Engleder @ 2021-11-24 20:32 UTC (permalink / raw)
  To: Yang Li; +Cc: David Miller, Jakub Kicinski, netdev, linux-kernel

>
> Remove .owner field if calls are used which set it automatically
>
> Eliminate the following coccicheck warning:
> ./drivers/net/ethernet/engleder/tsnep_main.c:1263:3-8: No need to set
> .owner here. The core will do it.
>
> 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 | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
> index c48e8ea..3d0408e 100644
> --- a/drivers/net/ethernet/engleder/tsnep_main.c
> +++ b/drivers/net/ethernet/engleder/tsnep_main.c
> @@ -1260,7 +1260,6 @@ static int tsnep_remove(struct platform_device *pdev)
>  static struct platform_driver tsnep_driver = {
>         .driver = {
>                 .name = TSNEP,
> -               .owner = THIS_MODULE,
>                 .of_match_table = of_match_ptr(tsnep_of_match),
>         },
>         .probe = tsnep_probe,
> --
> 1.8.3.1
>

Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 2/2] tsnep: fix platform_no_drv_owner.cocci warning
  2021-11-24 20:32   ` Gerhard Engleder
@ 2021-11-25  2:11     ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-11-25  2:11 UTC (permalink / raw)
  To: Gerhard Engleder, Yang Li; +Cc: David Miller, netdev, linux-kernel

On Wed, 24 Nov 2021 21:32:27 +0100 Gerhard Engleder wrote:
> >
> > Remove .owner field if calls are used which set it automatically
> >
> > Eliminate the following coccicheck warning:
> > ./drivers/net/ethernet/engleder/tsnep_main.c:1263:3-8: No need to set
> > .owner here. The core will do it.
> >
> > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> 
> Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>

Applied this one and took Gerhard's patch for the resource size thing.
Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-25  2:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24  2:36 [PATCH -next 1/2] tsnep: fix resource_size.cocci warnings Yang Li
2021-11-24  2:36 ` [PATCH -next 2/2] tsnep: fix platform_no_drv_owner.cocci warning Yang Li
2021-11-24 20:32   ` Gerhard Engleder
2021-11-25  2:11     ` Jakub Kicinski
2021-11-24 20:28 ` [PATCH -next 1/2] tsnep: fix resource_size.cocci warnings Gerhard Engleder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).