Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2206831pxm; Fri, 4 Mar 2022 11:22:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyb5all3LcXSCXsj+yZoKklsYMH0/wltja9MI6nWZ6174KCvgl7VsxVcV5J4LmR5B93zA0b X-Received: by 2002:a17:902:854a:b0:14e:e053:c8b3 with SMTP id d10-20020a170902854a00b0014ee053c8b3mr156177plo.8.1646421727179; Fri, 04 Mar 2022 11:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646421727; cv=none; d=google.com; s=arc-20160816; b=ontWlu4jXqTeAF6SlLEo534/vo1ctl4aSZxBZxMwamMGy+Meo3eSp8GwdTjHwj7sL+ mOR7dlQZ2j1qgQ1Lf/5Y8ouKclJSG13uKDyX7jW51NbTja+ROjw8R1EWh2PgPzq6qOFI y2W6NkJEQUTyWgl5Jd0nNYY+GLiD3ly+oG8FKeyM+bOUK82uWEg3CNTucAtKub4c/bU2 x825j8HmMaMz2PljB8tARCoCNxUdEaIG4A6nb2+ztslCi2HHsF3lnWfQ/exCdeCVjarc EFGQLyTpk4wwgBOf1ySkJwSpTg//bU4DXSmOZbuq0xDnUazywsedhJpiaDQ5mb+aQ8Kc 2ZJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=u7j3n8lWEDrQkJjSzxvS+tMybPuUeMEHU0Qn9JRqcgk=; b=IwyY2WnSIoURO4JhGPl9KSzpyLARxW5PW/ejlBiN+A9nj66OgzHe+dRawR/QY579Ew es83FbjGKMMqIrCIND1CTOUNgYH30s18JZCyfQE+ogjbzG4LmdQicUnEAL9a/w8L2mEL rnNNF3PyNMEe4m73tq7BYIpZhLQltaSE5viKe3dw/2G8d4FhJflHQ7x0BX0Hsk5GHyZ4 bvzKMVvf6kV2M8kKKuegTGTfGevvXe1KQAoq9VZ3TbY0BD6MOV4Upf4p01QKu8zC3ips Rrin8MtiE/lYDNR3NATuo+fN4qX3wYehzlHXmquq3DBjVZ4A41tF5QypibVbowPydXfx XtLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l186-20020a6391c3000000b0037d934406b0si1707458pge.55.2022.03.04.11.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 11:22:07 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A66892028A1; Fri, 4 Mar 2022 11:08:56 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235687AbiCDAMb (ORCPT + 99 others); Thu, 3 Mar 2022 19:12:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230003AbiCDAMb (ORCPT ); Thu, 3 Mar 2022 19:12:31 -0500 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6058A3EABB; Thu, 3 Mar 2022 16:11:44 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0V69QsyJ_1646352701; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0V69QsyJ_1646352701) by smtp.aliyun-inc.com(127.0.0.1); Fri, 04 Mar 2022 08:11:42 +0800 From: Yang Li To: mani@kernel.org Cc: hemantk@codeaurora.org, mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li , Abaci Robot Subject: [PATCH -next] bus: mhi: ep: Fix an ignored error return from ida_alloc() Date: Fri, 4 Mar 2022 08:11:39 +0800 Message-Id: <20220304001139.95082-1-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The return from the call to ida_alloc() is int, it can be a negative error code, however this is being assigned to an unsigned int variable 'mhi_cntrl->index', so assign the value to 'ret' concurrently to solve this problem without affecting other functions. Eliminate the following coccicheck warning: ./drivers/bus/mhi/ep/main.c:1422:5-21: WARNING: Unsigned expression compared with zero: mhi_cntrl -> index < 0 Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/bus/mhi/ep/main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c index 3e98107f08c4..b27e90d97029 100644 --- a/drivers/bus/mhi/ep/main.c +++ b/drivers/bus/mhi/ep/main.c @@ -1418,11 +1418,9 @@ int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl, mhi_ep_mmio_set_env(mhi_cntrl, MHI_EE_AMSS); /* Set controller index */ - mhi_cntrl->index = ida_alloc(&mhi_ep_cntrl_ida, GFP_KERNEL); - if (mhi_cntrl->index < 0) { - ret = mhi_cntrl->index; + mhi_cntrl->index = ret = ida_alloc(&mhi_ep_cntrl_ida, GFP_KERNEL); + if (ret < 0) goto err_destroy_wq; - } irq_set_status_flags(mhi_cntrl->irq, IRQ_NOAUTOEN); ret = request_irq(mhi_cntrl->irq, mhi_ep_irq, IRQF_TRIGGER_HIGH, -- 2.20.1.7.g153144c