diff mbox series

[v2,-next] IB/mlx5: Add missing error code

Message ID 20210222122343.19720-1-yuehaibing@huawei.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series [v2,-next] IB/mlx5: Add missing error code | expand

Commit Message

Yue Haibing Feb. 22, 2021, 12:23 p.m. UTC
Set err to -ENOMEM if kzalloc fails instead of 0.

Fixes: 759738537142 ("IB/mlx5: Enable subscription for device events over DEVX")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/infiniband/hw/mlx5/devx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Leon Romanovsky Feb. 22, 2021, 1:23 p.m. UTC | #1
On Mon, Feb 22, 2021 at 08:23:43PM +0800, YueHaibing wrote:
> Set err to -ENOMEM if kzalloc fails instead of 0.
>
> Fixes: 759738537142 ("IB/mlx5: Enable subscription for device events over DEVX")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/infiniband/hw/mlx5/devx.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>

Thanks,
Acked-by: Leon Romanovsky <leonro@nvidia.com>

And please don't send new version of patches as a reply-to, it is
annoying like hell.

Thanks
Yue Haibing Feb. 22, 2021, 2:21 p.m. UTC | #2
On 2021/2/22 21:23, Leon Romanovsky wrote:
> On Mon, Feb 22, 2021 at 08:23:43PM +0800, YueHaibing wrote:
>> Set err to -ENOMEM if kzalloc fails instead of 0.
>>
>> Fixes: 759738537142 ("IB/mlx5: Enable subscription for device events over DEVX")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>  drivers/infiniband/hw/mlx5/devx.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
> 
> Thanks,
> Acked-by: Leon Romanovsky <leonro@nvidia.com>
> 
> And please don't send new version of patches as a reply-to, it is
> annoying like hell.

Ok, Got it.

> Thanks
> .
>
Jason Gunthorpe March 1, 2021, 6:49 p.m. UTC | #3
On Mon, Feb 22, 2021 at 08:23:43PM +0800, YueHaibing wrote:
> Set err to -ENOMEM if kzalloc fails instead of 0.
> 
> Fixes: 759738537142 ("IB/mlx5: Enable subscription for device events over DEVX")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> Acked-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/hw/mlx5/devx.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to for-rc, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index ebc2a4355fa5..3c8e6a25465d 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -2073,8 +2073,10 @@  static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT)(
 
 		num_alloc_xa_entries++;
 		event_sub = kzalloc(sizeof(*event_sub), GFP_KERNEL);
-		if (!event_sub)
+		if (!event_sub) {
+			err = -ENOMEM;
 			goto err;
+		}
 
 		list_add_tail(&event_sub->event_list, &sub_list);
 		uverbs_uobject_get(&ev_file->uobj);