Re: [PATCH 2/2] staging: most: aim-cdev: report error returned by alloc_chrdev_region

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

 



On Thu, Aug 18, 2016 at 02:05:27PM +0200, Christian Gromm wrote:
> This patch passes the error code returned by function
> alloc_chrdev_region(). It is needed to stop the module
> from hiding the actual cause of failure.
> 
> Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
> ---
>  drivers/staging/most/aim-cdev/cdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
> index 20e2839..48d97bf 100644
> --- a/drivers/staging/most/aim-cdev/cdev.c
> +++ b/drivers/staging/most/aim-cdev/cdev.c
> @@ -507,8 +507,9 @@ static int __init mod_init(void)
>  	spin_lock_init(&ch_list_lock);
>  	ida_init(&minor_id);
>  
> -	if (alloc_chrdev_region(&aim_devno, 0, 50, "cdev") < 0)
> -		return -ENOMEM;
> +	err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev");
> +	if (err < 0)
> +		return err;

You forgot to clean up your idr structure :(

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux