Thread (12 messages) 12 messages, 3 authors, 2022-07-28

Re: [PATCH V2 1/5] ublk_drv: avoid to leak ublk device in case that add_disk fails

From: Ziyang Zhang <hidden>
Date: 2022-07-28 02:57:57

On 2022/7/28 08:18, Ming Lei wrote:
On Wed, Jul 27, 2022 at 06:21:32PM +0200, Christoph Hellwig wrote:
quoted
maybe s/avoid/don't/ in the subject?
OK, will change in V3.
quoted
quoted
-	get_device(&ub->cdev_dev);
 	ret = add_disk(disk);
 	if (ret) {
 		put_disk(disk);
 		goto out_unlock;
Maybe just add a put_device here in the error branch to keep
things simple?
That is fine.

Another way is to add 'out_put_disk' error label which can be
reused with previous error handling.
+1, adding another error label looks clear and simple.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help