Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vduse: refactor vdpa_dev_add for goto err handling

Next patches introduce more error paths in this function. Refactor it
so they can be accommodated through gotos.

Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Xie Yongji <xieyongji@bytedance.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260119143306.1818855-8-eperezma@redhat.com>

authored by

Eugenio Pérez and committed by
Michael S. Tsirkin
3e2ddda6 3543b04a

+14 -8
+14 -8
drivers/vdpa/vdpa_user/vduse_dev.c
··· 2171 2171 dev->bounce_size); 2172 2172 mutex_unlock(&dev->domain_lock); 2173 2173 if (!dev->domain) { 2174 - put_device(&dev->vdev->vdpa.dev); 2175 - return -ENOMEM; 2174 + ret = -ENOMEM; 2175 + goto domain_err; 2176 2176 } 2177 2177 2178 2178 ret = _vdpa_register_device(&dev->vdev->vdpa, dev->vq_num); 2179 2179 if (ret) { 2180 - put_device(&dev->vdev->vdpa.dev); 2181 - mutex_lock(&dev->domain_lock); 2182 - vduse_domain_destroy(dev->domain); 2183 - dev->domain = NULL; 2184 - mutex_unlock(&dev->domain_lock); 2185 - return ret; 2180 + goto register_err; 2186 2181 } 2187 2182 2188 2183 return 0; 2184 + 2185 + register_err: 2186 + mutex_lock(&dev->domain_lock); 2187 + vduse_domain_destroy(dev->domain); 2188 + dev->domain = NULL; 2189 + mutex_unlock(&dev->domain_lock); 2190 + 2191 + domain_err: 2192 + put_device(&dev->vdev->vdpa.dev); 2193 + 2194 + return ret; 2189 2195 } 2190 2196 2191 2197 static void vdpa_dev_del(struct vdpa_mgmt_dev *mdev, struct vdpa_device *dev)