linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Joe Perches <joe@perches.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
Date: Thu, 09 Oct 2014 09:20:23 +0200	[thread overview]
Message-ID: <54363737.50700@gmail.com> (raw)
In-Reply-To: <20141008224816.GA3583@kroah.com>

On 10/09/2014 12:48 AM, Greg Kroah-Hartman wrote:
> On Tue, Oct 07, 2014 at 05:54:48PM +0200, Dzmitry Sledneu wrote:
>> Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
>>
>> Signed-off-by: Dzmitry Sledneu <dzmitry.sledneu@gmail.com>
>>
>> ---
>>  drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
>> index 9764a9a..0c18c4c 100644
>> --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
>> +++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
>> @@ -295,10 +295,8 @@ static int gs_fpgaboot(void)
>>  	struct fpgaimage	*fimage;
>>  
>>  	fimage = kmalloc(sizeof(struct fpgaimage), GFP_KERNEL);
>> -	if (fimage == NULL) {
>> -		pr_err("No memory is available\n");
>> -		goto err_out;
>> -	}
>> +	if (!fimage)
>> +		return -ENOMEM;
>>  
>>  	err = gs_load_image(fimage, file);
>>  	if (err) {
>> @@ -340,7 +338,6 @@ err_out2:
>>  err_out1:
>>  	kfree(fimage);
>>  
>> -err_out:
>>  	return -1;
>>  
>>  }
> 
> Doesn't apply to my tree properly :(
> 

I looked at it in your tree and it has already been fixed there.

But the fix is not quite correct, because it returns -ENOPERM (-1)
it case kmalloc fails and not -ENOMEM (-12).

I will submit a new patch to fix this.

Dzmitry

  reply	other threads:[~2014-10-09  7:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07 14:37 [PATCH 001/002] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" checkpatch.pl warning Dzmitry Sledneu
2014-10-07 14:39 ` [PATCH 002/002] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" " Dzmitry Sledneu
2014-10-07 15:23   ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Dzmitry Sledneu
2014-10-07 15:24     ` [PATCH v2 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" " Dzmitry Sledneu
2014-10-07 15:30     ` [PATCH v2 1/2] staging: gs_fpgaboot: Fix "Possible unnecessary KERN_INFO" " Joe Perches
2014-10-07 15:53       ` [PATCH v3 1/2] staging: gs_fpgaboot: Use print_hex_dump_bytes instead of pr_info Dzmitry Sledneu
2014-10-07 15:54         ` [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning Dzmitry Sledneu
2014-10-08 22:48           ` Greg Kroah-Hartman
2014-10-09  7:20             ` Dzmitry Sledneu [this message]
2014-10-09  7:22               ` [PATCH v4] staging: gs_fpgaboot: Fix "out of memory" error handling Dzmitry Sledneu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54363737.50700@gmail.com \
    --to=dzmitry.sledneu@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).