Message ID | 20230717073429.2115015-1-djakov@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp972706vqt; Mon, 17 Jul 2023 01:12:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlG1ojUp8J8Q+/LGOuSJWnwo1YJ848heRPQIrTDM8+lB/5X83tQxSSkxnFDHQtFMqPOkmgBJ X-Received: by 2002:a05:6a20:a120:b0:132:e62d:c53b with SMTP id q32-20020a056a20a12000b00132e62dc53bmr15252656pzk.44.1689581574793; Mon, 17 Jul 2023 01:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689581574; cv=none; d=google.com; s=arc-20160816; b=fdUgLOh0Tho9dkwB1xCt+ApbRdL5h/O5WmkcTEHLopmUbhikZkL6MuaIVB9kKJB2wY ff/6ZRJPh8Gz00gb9QUcLwjyoHWAXDdUDd/jqJrKK3TnhymaCBbg55Qc5F8hi+trJt8L Mf3ZjBLrz3/sVtvU6J/5xMfagKh4TaqjiWG9P25Ozaf4gLbdFjtbT7oSSPWY4vwBtj/z AproukoX0/9mpTXWndYWtw2PjaKPA1g5iD0nye6JR1I9jIHuyo4VYCNibpcY4/C/hPiA 2z5ByZ1khkyhMKBoX/fybqIyjs7WhJa6I547dAHJpWAJG2AsogAe4+enmyP0TsMnRpjJ WsHQ== 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:dkim-signature; bh=+yIVvtzlmyEjcWvGeOtaFhkaksnoC7lzgip+L0Tb0wE=; fh=1yx/I7lpYrfuZxPuvx6qvSzkXjA8H5GgOlx9SVPguN0=; b=A0Ugz7wZWkl1hhcWMmS0UG2J/631wItU8fntomqCXUCg9eMntgdM3yez81tFHFJRZf oVfJbGEm2hVKD6uL6Y+ofgBt3ThxQyMFV7UbUAwmsC0dj1mkZyHPqFEhrGlFQxzRM2hW fS9Ix4RnATxJj6o8K12gNesKZcdGBSn7NbCpoctmmq/1NeAOq/AEegTHecr03RfzTnKo FNnd6ruPdn+gh1ukLbwwh/COuoRwq1p+TcfmOREjFeus49mtpP/LCro9Rg3HimV6EiI4 w2tcdDtcATzzw/XNtSkWadHomBS/r4d8/hFtFyf97OQVnCU7T/HwPbh4UL4zQKWwvJ1K 63Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HxcV5P7C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv10-20020a056a00414a00b006724753efe8si11157318pfb.192.2023.07.17.01.12.41; Mon, 17 Jul 2023 01:12:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HxcV5P7C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbjGQHfA (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Mon, 17 Jul 2023 03:35:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbjGQHeo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 17 Jul 2023 03:34:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 273DE1A4; Mon, 17 Jul 2023 00:34:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BA19A60F97; Mon, 17 Jul 2023 07:34:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81F04C433C9; Mon, 17 Jul 2023 07:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689579282; bh=vhh6DlpbxTDrDy1mnUesEe41wUAuLHP4kh7GVzyGoPs=; h=From:To:Cc:Subject:Date:From; b=HxcV5P7CSC/TxEWjWv7GBIP7qnLDX3+r2VgAbr4JbgXfoMZk1v05VYOLEGi2b6T1c ZTbIik1WgXcwLXUcd7THgvZ4zY7MxZjI7uAxVxZTpaQISuKmcPcUR7VeqgqTM/cmWL qu3jeVBG7CWsHl3E/tCHXWcNBzFcAfO6z64oKKqSKldQyf2lwHh459ThOfNHjG63yM vH1tEC5Z8PUdxx9DKHX1LGzyfFJo/uAEMKGHmBh2z6QTEnnYWNBZFqvWx2fTIBFD3D wBZ+3yBm4PAEu2VfxavrfqQBokUr2gitew3dSSjbdIw2kTcInOfcmY9Np6JEM8Fb/A VGTkT1C0dIMNw== From: djakov@kernel.org To: djakov@kernel.org, konrad.dybcio@linaro.org, andersson@kernel.org Cc: stephan@gerhold.net, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] interconnect: qcom: icc-rpm: Initialize ret variable to fix smatch error Date: Mon, 17 Jul 2023 10:34:29 +0300 Message-Id: <20230717073429.2115015-1-djakov@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771654689486602978 X-GMAIL-MSGID: 1771654689486602978 |
Series |
interconnect: qcom: icc-rpm: Initialize ret variable to fix smatch error
|
|
Commit Message
Georgi Djakov
July 17, 2023, 7:34 a.m. UTC
From: Georgi Djakov <djakov@kernel.org> Fix the following smatch error: drivers/interconnect/qcom/icc-rpm.c:243 qcom_icc_rpm_set() error: uninitialized symbol 'ret'. Fixes: 32846c4a8f2a ("interconnect: qcom: icc-rpm: Set bandwidth on both contexts") Signed-off-by: Georgi Djakov <djakov@kernel.org> --- drivers/interconnect/qcom/icc-rpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Jul 17, 2023 at 10:34:29AM +0300, djakov@kernel.org wrote: > From: Georgi Djakov <djakov@kernel.org> > > Fix the following smatch error: > drivers/interconnect/qcom/icc-rpm.c:243 qcom_icc_rpm_set() error: uninitialized symbol 'ret'. > > Fixes: 32846c4a8f2a ("interconnect: qcom: icc-rpm: Set bandwidth on both contexts") > Signed-off-by: Georgi Djakov <djakov@kernel.org> Thanks for spotting this! > --- > drivers/interconnect/qcom/icc-rpm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c > index 612390b9eb18..6718cc648d75 100644 > --- a/drivers/interconnect/qcom/icc-rpm.c > +++ b/drivers/interconnect/qcom/icc-rpm.c > @@ -206,7 +206,7 @@ static int qcom_icc_qos_set(struct icc_node *node) > > static int qcom_icc_rpm_set(struct qcom_icc_node *qn, u64 *bw) > { > - int ret, rpm_ctx = 0; > + int ret = 0, rpm_ctx = 0; > u64 bw_bps; > > if (qn->qos.ap_owned) I think it would be a bit clearer to change the "return ret;" at the end of the function to "return 0;". The ret variable is only used inside the for loop and always handled there, so we always want to return 0 when reaching the end of the function. Thanks, Stephan
On Mon, Jul 17, 2023 at 03:55:34PM +0300, djakov@kernel.org wrote: > From: Georgi Djakov <djakov@kernel.org> > > Fix the following smatch error: > drivers/interconnect/qcom/icc-rpm.c:243 qcom_icc_rpm_set() error: uninitialized symbol 'ret'. > > Fixes: 32846c4a8f2a ("interconnect: qcom: icc-rpm: Set bandwidth on both contexts") > Signed-off-by: Georgi Djakov <djakov@kernel.org> > --- > v2: Just return 0 when reaching the end of the function. (Thanks Stephan!) > v1: https://lore.kernel.org/r/20230717073429.2115015-1-djakov@kernel.org > > drivers/interconnect/qcom/icc-rpm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c > index 612390b9eb18..2c16917ba1fd 100644 > --- a/drivers/interconnect/qcom/icc-rpm.c > +++ b/drivers/interconnect/qcom/icc-rpm.c > @@ -240,7 +240,7 @@ static int qcom_icc_rpm_set(struct qcom_icc_node *qn, u64 *bw) > } > } > > - return ret; > + return 0; > } > > /** Thanks! Reviewed-by: Stephan Gerhold <stephan@gerhold.net>
diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 612390b9eb18..6718cc648d75 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -206,7 +206,7 @@ static int qcom_icc_qos_set(struct icc_node *node) static int qcom_icc_rpm_set(struct qcom_icc_node *qn, u64 *bw) { - int ret, rpm_ctx = 0; + int ret = 0, rpm_ctx = 0; u64 bw_bps; if (qn->qos.ap_owned)