habanalabs: free signal handle on failure
Fix a bug where in case of failure to allocate idr, the handle's memory wasn't freed as part of the error handling code. Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
parent
b166465452
commit
fee187fe46
|
@ -1838,7 +1838,7 @@ static int cs_ioctl_reserve_signals(struct hl_fpriv *hpriv,
|
||||||
if (hdl_id < 0) {
|
if (hdl_id < 0) {
|
||||||
dev_err(hdev->dev, "Failed to allocate IDR for a new signal reservation\n");
|
dev_err(hdev->dev, "Failed to allocate IDR for a new signal reservation\n");
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto out;
|
goto free_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->id = hdl_id;
|
handle->id = hdl_id;
|
||||||
|
@ -1891,7 +1891,9 @@ remove_idr:
|
||||||
idr_remove(&mgr->handles, hdl_id);
|
idr_remove(&mgr->handles, hdl_id);
|
||||||
spin_unlock(&mgr->lock);
|
spin_unlock(&mgr->lock);
|
||||||
|
|
||||||
|
free_handle:
|
||||||
kfree(handle);
|
kfree(handle);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue