Re: [PATCH] GPU:drm: returning ENOMEM

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

 



Hi F.A.Sulaiman,
On Sat, Aug 28, 2021 at 09:10:27PM +0530, F.A.Sulaiman wrote:
> When memory allocation is failed this patch returns out of memory error instead of -1.
> 
> Signed-off-by: F.A. SULAIMAN <asha.16@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/udl/udl_connector.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
> index 3750fd216131..afebab6186ab 100644
> --- a/drivers/gpu/drm/udl/udl_connector.c
> +++ b/drivers/gpu/drm/udl/udl_connector.c
> @@ -24,7 +24,7 @@ static int udl_get_edid_block(void *data, u8 *buf, unsigned int block,
>  
>  	read_buff = kmalloc(2, GFP_KERNEL);
>  	if (!read_buff)
> -		return -1;
> +		return -ENOMEM;
>  
>  	for (i = 0; i < len; i++) {
>  		int bval = (i + block * EDID_LENGTH) << 8;

The function is only used in a context where the return value is checked
if it is o or not zero.
But it seems prudent to return a proper error code anyways.

Please revisit the function and fix the other return -1;
Propagate the error from the called function and avoid the hardcoded -1.

	Sam



[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