lkml.org 
[lkml]   [2014]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/2] staging: gs_fpgaboot: Fix "Possible unnecessary 'out of memory' message" checkpatch.pl warning
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


\
 
 \ /
  Last update: 2014-10-09 10:02    [W:0.039 / U:1.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site