Re: [PATCH 3/3] staging: most: aim-cdev: relocate call to ida_init()

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

 



On Fri, Aug 19, 2016 at 01:09:35PM +0200, Christian Gromm wrote:
> This patch moves the initialization of the idr structure towards the end
> of the module's init routine. This keeps the code compact and eliminates
> the need of having to call ida_destroy() in case the function exits with
> an exception.
> 
> Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
> ---
>  drivers/staging/most/aim-cdev/cdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
> index db6f458..3864009 100644
> --- a/drivers/staging/most/aim-cdev/cdev.c
> +++ b/drivers/staging/most/aim-cdev/cdev.c
> @@ -505,7 +505,6 @@ static int __init mod_init(void)
>  
>  	INIT_LIST_HEAD(&channel_list);
>  	spin_lock_init(&ch_list_lock);
> -	ida_init(&minor_id);
>  
>  	err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev");
>  	if (err < 0)
> @@ -521,6 +520,7 @@ static int __init mod_init(void)
>  	err = most_register_aim(&cdev_aim);
>  	if (err)
>  		goto dest_class;
> +	ida_init(&minor_id);

But can't the minor_id be used before this call?  most_register_aim()
could call into a driver and have a cdev be wanted, right?

thanks,

greg k-h
_______________________________________________
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