From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4F12C64E75 for ; Wed, 25 Nov 2020 06:46:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98A572067D for ; Wed, 25 Nov 2020 06:46:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726929AbgKYGqZ (ORCPT ); Wed, 25 Nov 2020 01:46:25 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:7733 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbgKYGqY (ORCPT ); Wed, 25 Nov 2020 01:46:24 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cgrxs0FjzzkfbD; Wed, 25 Nov 2020 14:45:53 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Wed, 25 Nov 2020 14:46:12 +0800 From: Qinglang Miao To: Vinod Koul , Bard Liao , Pierre-Louis Bossart , Sanyog Kale CC: , , "Qinglang Miao" Subject: [PATCH] soundwire: Fix error return code in sdw_compute_port_params Date: Wed, 25 Nov 2020 14:50:35 +0800 Message-ID: <20201125065035.154262-1-miaoqinglang@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix to return the error code -EINVAL in sdw_compute_port_params instead of 0. Fixes: 9026118f20e2 ("soundwire: Add generic bandwidth allocation algorithm") Reported-by: Hulk Robot Signed-off-by: Qinglang Miao --- drivers/soundwire/generic_bandwidth_allocation.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/generic_bandwidth_allocation.c b/drivers/soundwire/generic_bandwidth_allocation.c index 0bdef38c9..ad857ac62 100644 --- a/drivers/soundwire/generic_bandwidth_allocation.c +++ b/drivers/soundwire/generic_bandwidth_allocation.c @@ -283,8 +283,10 @@ static int sdw_compute_port_params(struct sdw_bus *bus) if (ret < 0) return ret; - if (group.count == 0) + if (group.count == 0) { + ret = -EINVAL; goto out; + } params = kcalloc(group.count, sizeof(*params), GFP_KERNEL); if (!params) { -- 2.23.0