Re: [PATCH rdma-next] IB/umad: Avoid additional device reference during open()/close()

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

 



On Tue, Jan 22, 2019 at 08:33:00AM +0200, Leon Romanovsky wrote:
> @@ -1283,8 +1278,10 @@ static void ib_umad_kill_port(struct ib_umad_port *port)
>  	mutex_unlock(&port->file_mutex);
>  
>  	cdev_device_del(&port->sm_cdev, &port->sm_dev);
> +	/* balances device_initialize() */
>  	put_device(&port->sm_dev);
>  	cdev_device_del(&port->cdev, &port->dev);
> +	/* balances device_initialize() */
>  	put_device(&port->dev);
>  	ida_free(&umad_ida, port->dev_num);

I'm going to re-order this, the ida_free should be before the
put_device. It works OK as-is only because the caller is holding the
enclosing dev structure kref.

	cdev_device_del(&port->sm_cdev, &port->sm_dev);
	cdev_device_del(&port->cdev, &port->dev);
	ida_free(&umad_ida, port->dev_num);

	/* balances device_initialize() */
	put_device(&port->sm_dev);
	put_device(&port->dev);

Otherwise applied to for-next

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux