Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1336422 > unrolled thread

[PATCH] lance: Return correct error code

Started byAmitoj Kaur Chawla <amitoj1606@gmail.com>
First post2016-02-17 14:40 +0100
Last post2016-02-17 15:30 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] lance: Return correct error code Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-02-17 14:40 +0100
    Re: [PATCH] lance: Return correct error code Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-02-17 15:20 +0100
      Re: [PATCH] lance: Return correct error code Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-02-17 15:30 +0100

#1336422 — [PATCH] lance: Return correct error code

FromAmitoj Kaur Chawla <amitoj1606@gmail.com>
Date2016-02-17 14:40 +0100
Subject[PATCH] lance: Return correct error code
Message-ID<r3auM-73z-27@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1336468

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2016-02-17 15:20 +0100
Message-ID<r3b7r-7xk-5@gated-at.bofh.it>
In reply to#1336422
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

[toc] | [prev] | [next] | [standalone]


#1336474

FromAmitoj Kaur Chawla <amitoj1606@gmail.com>
Date2016-02-17 15:30 +0100
Message-ID<r3bh8-7Ch-11@gated-at.bofh.it>
In reply to#1336468
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web