Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1404088pxb; Mon, 22 Feb 2021 00:28:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxP2tlNxBsWK4X2Iot0BcfRdzWoH/Q6FKnqTCBoi+VJ7ucnIAUw7af3dY/A2f9pJ19gmIkb X-Received: by 2002:a17:906:6942:: with SMTP id c2mr5071382ejs.425.1613982484659; Mon, 22 Feb 2021 00:28:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613982484; cv=none; d=google.com; s=arc-20160816; b=Uuyw+7P4p4jJY84XQ3+qSYKf6AUBYcvzwn6N8L05o6gCnVxrIgXV5+Q1hjtoX9NUKp 3WnmVAmAc69O85ZPBEo5SWBvINKgULXl21HM1nfBSeCRGI4U2teZcdX3nDRZRzhaXWxP aDDGfzCdGUq1PnDAdn/I82nhFzfzjAyv5B7hGC9PpSkhxCVKlimJvjQg2dB2VURgTjph IZJeqEjnQERBBN0FP8fWOYV7EpAs3E9yDudrzqCLjhPYTluLfyvKivSNumGt8zq1/qEI UK4cKU0RxEId8F+yBICT8MCZqff5AWYymwJqwOQ3Shn0jPv6nCpNPaDAkmrqiJhzeotZ Scdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=Vg3d8zp5rq44lt1y+IrNx7VD6Y/y2cQN8kC6DIinl8g=; b=okGYde/r6dQipqumbh50BmY2IXPBtMdHwEoK8fs6etpkNdPWraBPpkm9rWlDssH6d7 zoFEw+bFLKi6JNKEmTonf/jDixbhxxLSZ9DnyUzNBBlKWwzptSjXpQlL5PuB32sJZwQ4 XVjvxxJOTMJ51BF/Y8gMeXosSdiib6pz8nYjmS6q019l5XKIbpFKyxcV/Bnyg4x5jw7W z9Etf6W94XEHTZMAud5L0uukbcFIlL0ablkrGbaxNHH0B9jDXlqvBNSY7kvDATv7G1Db KHkqVL3qLvkIdUjqGSyzb3La80LAm/sZSC7H3eeTUaQyQUDyg97aqRGlosPdPhdElGJP pw0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r5si10843702edv.548.2021.02.22.00.27.42; Mon, 22 Feb 2021 00:28:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230112AbhBVI0J (ORCPT + 99 others); Mon, 22 Feb 2021 03:26:09 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:12632 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229852AbhBVIZ7 (ORCPT ); Mon, 22 Feb 2021 03:25:59 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DkZvf4sBlz16BKQ; Mon, 22 Feb 2021 16:23:42 +0800 (CST) Received: from localhost (10.174.179.96) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Mon, 22 Feb 2021 16:25:08 +0800 From: YueHaibing To: , , , CC: , , YueHaibing Subject: [PATCH -next] IB/mlx5: Add missing error code Date: Mon, 22 Feb 2021 16:25:03 +0800 Message-ID: <20210222082503.22388-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.179.96] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/infiniband/hw/mlx5/devx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.20.1