netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] seeq: use PTR_RET at init_module of driver
@ 2012-07-29 13:28 Devendra Naga
  2012-07-29 17:41 ` David Howells
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Devendra Naga @ 2012-07-29 13:28 UTC (permalink / raw)
  To: David S. Miller, Jeff Kirsher, David Howells, Jiri Pirko,
	Pradeep A Dalvi, netdev
  Cc: Devendra Naga

the driver sees wether the dev_seeq pointer is having a error that can be
read by using the PTR_ERR, and returns it at error case, other wise 0 at
success case.

the PTR_RET does the same thing, and use PTR_RET instead of redoing the
code of PTR_RET

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
---
This patch is actually made by using coccinelle, and also by looking
at the PTR_RET function.

as its implementation is
static int PTR_RET(void *ptr)
{
	if (IS_ERR(ptr)
		return PTR_ERR(ptr);
	return 0;
}

by using this i removed the following code and replaced with PTR_RET....


 drivers/net/ethernet/seeq/seeq8005.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/seeq/seeq8005.c b/drivers/net/ethernet/seeq/seeq8005.c
index 698edbb..d6e50de 100644
--- a/drivers/net/ethernet/seeq/seeq8005.c
+++ b/drivers/net/ethernet/seeq/seeq8005.c
@@ -736,9 +736,7 @@ MODULE_PARM_DESC(irq, "SEEQ 8005 IRQ number");
 int __init init_module(void)
 {
 	dev_seeq = seeq8005_probe(-1);
-	if (IS_ERR(dev_seeq))
-		return PTR_ERR(dev_seeq);
-	return 0;
+	return PTR_RET(dev_seeq);
 }
 
 void __exit cleanup_module(void)
-- 
1.7.9.5

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

* Re: [PATCH] seeq: use PTR_RET at init_module of driver
  2012-07-29 13:28 [PATCH] seeq: use PTR_RET at init_module of driver Devendra Naga
@ 2012-07-29 17:41 ` David Howells
  2012-07-29 21:34 ` Jiri Pirko
  2012-07-30  6:19 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Howells @ 2012-07-29 17:41 UTC (permalink / raw)
  To: Devendra Naga
  Cc: dhowells, David S. Miller, Jeff Kirsher, Jiri Pirko,
	Pradeep A Dalvi, netdev

Devendra Naga <develkernel412222@gmail.com> wrote:

> the driver sees wether the dev_seeq pointer is having a error that can be
> read by using the PTR_ERR, and returns it at error case, other wise 0 at
> success case.
> 
> the PTR_RET does the same thing, and use PTR_RET instead of redoing the
> code of PTR_RET
> 
> Signed-off-by: Devendra Naga <develkernel412222@gmail.com>

Acked-by: David Howells <dhowells@redhat.com>

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

* Re: [PATCH] seeq: use PTR_RET at init_module of driver
  2012-07-29 13:28 [PATCH] seeq: use PTR_RET at init_module of driver Devendra Naga
  2012-07-29 17:41 ` David Howells
@ 2012-07-29 21:34 ` Jiri Pirko
  2012-07-30  6:19 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2012-07-29 21:34 UTC (permalink / raw)
  To: Devendra Naga
  Cc: David S. Miller, Jeff Kirsher, David Howells, Jiri Pirko,
	Pradeep A Dalvi, netdev

Sun, Jul 29, 2012 at 03:28:47PM CEST, develkernel412222@gmail.com wrote:
>the driver sees wether the dev_seeq pointer is having a error that can be
>read by using the PTR_ERR, and returns it at error case, other wise 0 at
>success case.
>
>the PTR_RET does the same thing, and use PTR_RET instead of redoing the
>code of PTR_RET
>
>Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
>---
>This patch is actually made by using coccinelle, and also by looking
>at the PTR_RET function.
>
>as its implementation is
>static int PTR_RET(void *ptr)
>{
>	if (IS_ERR(ptr)
>		return PTR_ERR(ptr);
>	return 0;
>}
>
>by using this i removed the following code and replaced with PTR_RET....
>
>
> drivers/net/ethernet/seeq/seeq8005.c |    4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
>diff --git a/drivers/net/ethernet/seeq/seeq8005.c b/drivers/net/ethernet/seeq/seeq8005.c
>index 698edbb..d6e50de 100644
>--- a/drivers/net/ethernet/seeq/seeq8005.c
>+++ b/drivers/net/ethernet/seeq/seeq8005.c
>@@ -736,9 +736,7 @@ MODULE_PARM_DESC(irq, "SEEQ 8005 IRQ number");
> int __init init_module(void)
> {
> 	dev_seeq = seeq8005_probe(-1);
>-	if (IS_ERR(dev_seeq))
>-		return PTR_ERR(dev_seeq);
>-	return 0;
>+	return PTR_RET(dev_seeq);
> }
> 
> void __exit cleanup_module(void)
>-- 
>1.7.9.5
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html


Reviewed-by: Jiri Pirko <jiri@resnulli.us>

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

* Re: [PATCH] seeq: use PTR_RET at init_module of driver
  2012-07-29 13:28 [PATCH] seeq: use PTR_RET at init_module of driver Devendra Naga
  2012-07-29 17:41 ` David Howells
  2012-07-29 21:34 ` Jiri Pirko
@ 2012-07-30  6:19 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-07-30  6:19 UTC (permalink / raw)
  To: develkernel412222; +Cc: jeffrey.t.kirsher, dhowells, jpirko, netdev, netdev

From: Devendra Naga <develkernel412222@gmail.com>
Date: Sun, 29 Jul 2012 19:13:47 +0545

> the driver sees wether the dev_seeq pointer is having a error that can be
> read by using the PTR_ERR, and returns it at error case, other wise 0 at
> success case.
> 
> the PTR_RET does the same thing, and use PTR_RET instead of redoing the
> code of PTR_RET
> 
> Signed-off-by: Devendra Naga <develkernel412222@gmail.com>

Applied.

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

end of thread, other threads:[~2012-07-30  6:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-29 13:28 [PATCH] seeq: use PTR_RET at init_module of driver Devendra Naga
2012-07-29 17:41 ` David Howells
2012-07-29 21:34 ` Jiri Pirko
2012-07-30  6:19 ` David Miller

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