netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lance: Return correct error code
@ 2016-02-17 13:35 Amitoj Kaur Chawla
  2016-02-17 14:16 ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-17 13:35 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: julia.lawall

The return value of kzalloc on failure should be -ENOMEM and
not -ENODEV.

Additionally, removed the following checkpatch warnings:
ERROR: spaces required around that '==' (ctx:VxV)
ERROR: space required before the open parenthesis '('
CHECK: Comparison to NULL could be written "!lp"

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/net/ethernet/amd/lance.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/lance.c b/drivers/net/ethernet/amd/lance.c
index 256f590..3a7ebfd 100644
--- a/drivers/net/ethernet/amd/lance.c
+++ b/drivers/net/ethernet/amd/lance.c
@@ -547,8 +547,8 @@ static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int
 	/* Make certain the data structures used by the LANCE are aligned and DMAble. */
 
 	lp = kzalloc(sizeof(*lp), GFP_DMA | GFP_KERNEL);
-	if(lp==NULL)
-		return -ENODEV;
+	if (!lp)
+		return -ENOMEM;
 	if (lance_debug > 6) printk(" (#0x%05lx)", (unsigned long)lp);
 	dev->ml_priv = lp;
 	lp->name = chipname;
-- 
1.9.1

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

* Re: [PATCH] lance: Return correct error code
  2016-02-17 13:35 [PATCH] lance: Return correct error code Amitoj Kaur Chawla
@ 2016-02-17 14:16 ` Sergei Shtylyov
  2016-02-17 14:24   ` Amitoj Kaur Chawla
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2016-02-17 14:16 UTC (permalink / raw)
  To: Amitoj Kaur Chawla, netdev, linux-kernel; +Cc: julia.lawall

Hello.

On 2/17/2016 4:35 PM, Amitoj Kaur Chawla wrote:

> The return value of kzalloc on failure should be -ENOMEM and

    kzalloc() returns NULL on failure! You need to clarify your patch 
description, so that it makes some sense.

> not -ENODEV.
>
> Additionally, removed the following checkpatch warnings:
> ERROR: spaces required around that '==' (ctx:VxV)
> ERROR: space required before the open parenthesis '('
> CHECK: Comparison to NULL could be written "!lp"
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
[...]

MBR, Sergei

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

* Re: [PATCH] lance: Return correct error code
  2016-02-17 14:16 ` Sergei Shtylyov
@ 2016-02-17 14:24   ` Amitoj Kaur Chawla
  0 siblings, 0 replies; 3+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-17 14:24 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, Linux-Kernel@Vger. Kernel. Org, Julia Lawall

On Wed, Feb 17, 2016 at 7:46 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
> On 2/17/2016 4:35 PM, Amitoj Kaur Chawla wrote:
>
>> The return value of kzalloc on failure should be -ENOMEM and
>
>
>    kzalloc() returns NULL on failure! You need to clarify your patch
> description, so that it makes some sense.
>

Okay, thanks for the feedback. Will send v2.

Amitoj

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

end of thread, other threads:[~2016-02-17 14:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-17 13:35 [PATCH] lance: Return correct error code Amitoj Kaur Chawla
2016-02-17 14:16 ` Sergei Shtylyov
2016-02-17 14:24   ` Amitoj Kaur Chawla

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