Add check for dma_set_mask() and return the error if it fails. Fixes: 6bf625a4140f ("Drivers: hv: vmbus: Rework use of DMA_BIT_MASK(64)") Signed-off-by: Jiasheng Jiang <jiasheng@xxxxxxxxxxx> --- drivers/hv/vmbus_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 1c65a6dfb9fa..68b7be2762ea 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1908,7 +1908,11 @@ int vmbus_device_register(struct hv_device *child_device_obj) child_device_obj->device.dma_parms = &child_device_obj->dma_parms; child_device_obj->device.dma_mask = &child_device_obj->dma_mask; - dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64)); + ret = dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64)); + if (ret) { + put_device(&child_device_obj->device); + return ret; + } /* * Register with the LDM. This will kick off the driver/device -- 2.25.1