Re: [PATCH 1/4] fbdev: imsttfb: Fix error handling in init_imstt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> The return value was overlooked from a call of
>> the function “fb_alloc_cmap”.
>>
>> * Thus use a corresponding error check.
>>
>> * Add two jump targets so that a bit of exception handling
>>    can be better reused at the end of this function.
…
>> +++ b/drivers/video/fbdev/imsttfb.c
…
>> @@ -1452,17 +1452,25 @@ static int init_imstt(struct fb_info *info)
>>                     FBINFO_HWACCEL_FILLRECT |
>>                     FBINFO_HWACCEL_YPAN;
>>
>> -    fb_alloc_cmap(&info->cmap, 0, 0);
>> +    ret = fb_alloc_cmap(&info->cmap, 0, 0);
>> +    if (ret)
>> +        goto release_framebuffer;
>>
>>       if (register_framebuffer(info) < 0) {
>> -        framebuffer_release(info);
>> -        return -ENODEV;
>> +        fb_dealloc_cmap(&info->cmap);
>> +        goto e_nodev;
>>       }
>>
>>       tmp = (read_reg_le32(par->dc_regs, SSTATUS) & 0x0f00) >> 8;
>>       fb_info(info, "%s frame buffer; %uMB vram; chip version %u\n",
>>           info->fix.id, info->fix.smem_len >> 20, tmp);
>>       return 0;
>> +
>> +e_nodev:
>> +    ret = -ENODEV;
>
> I think the return value isn't checked at all, so you could
> simply return below "-ENODEV" for all cases (instead of "return ret").
> Then you don't need the e_nodev label and can simplify the flow.

Can it be helpful to distinguish involved error codes better?

How should return value ignorance be avoided further?

Regards,
Markus




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux