Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1421188rdh; Mon, 25 Sep 2023 12:13:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6GMCB0PyODUEIvk/bbI423B1dXXZcEGIodkP7Zxg7wyyIRf9DSRWQd18qYX28U3Yd8D/U X-Received: by 2002:a05:6870:c587:b0:192:6fce:d3be with SMTP id ba7-20020a056870c58700b001926fced3bemr7703699oab.1.1695669215115; Mon, 25 Sep 2023 12:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695669215; cv=none; d=google.com; s=arc-20160816; b=Z0fCDWqKOqE8NIQYg5ntRCPRC5jnX3mLice8jEbCW/0NCuNfnGqdzXmabCer6MSuvv jAhz58WVBkUKwi7as4IrnAuMp+VNsR0gqda1a4xLYklRVTOEy8BaqIzsxuNIFGC38K/h bm+QCmeGYsHLrUVznDJbY7HBUUJzFIfALwjI3fZ34Nh31Ju9jxNWjqywmXBf9nv/PzMi J37YyTjvykCDjTtsZ+8LsMvzK7I2b+PqUB4tzWRq7jU9wzX2x/0dbST7g/3yamw+jSYs LxzMHCozh5WAz6puh54BLHXDf8A/IcSec8KESRAgoRCPShdNW8HC3ldM4X3xRrrtRU0J WmoA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wxw1p33YOE1Wx3IdS6/yDe9IgDNF8zci3+vg+kboqRc=; fh=0iKC8n1xKtkvw+5RDzSud32j7h9ilf6Mvh4d+L1hSv0=; b=GodW6CROrhtzT1j2Ar3OVLq3M/lT3K69XaYLuU6GtFRfQAvjyPvs+mIPRbSVy8hbJX Nlain8MTheWmz/gxY+BYKr6HZOOXRTXh8Cf99kDP/Ye7+ShcNlruP4AqKtOh6gLnypCT 7Igdya47h+zZpv9sPv4pibN9yW7xNUOVt5zpji/uQLPie+K/tD08dNxPut+pGLydkxE5 vqjtqpPNwu6Da2hQSmRygWfdCM0/Y5/32OrFoSf+xVyl/8e5VCTwTWHPBDvzw13FV1ay chFI/KEa/lLamaQdebbKYE29gCg8TuL283c7SFVlDQdU56gMv9ztPc978QurRWIaSG+g /p/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwOH8+NW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bv124-20020a632e82000000b0056da0ae25cfsi10396472pgb.196.2023.09.25.12.13.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 12:13:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwOH8+NW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id EBF6080A4985; Mon, 25 Sep 2023 06:18:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbjIYNS3 (ORCPT + 99 others); Mon, 25 Sep 2023 09:18:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231809AbjIYNSN (ORCPT ); Mon, 25 Sep 2023 09:18:13 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7026E10E for ; Mon, 25 Sep 2023 06:18:05 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-50337b43ee6so10566864e87.3 for ; Mon, 25 Sep 2023 06:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695647883; x=1696252683; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wxw1p33YOE1Wx3IdS6/yDe9IgDNF8zci3+vg+kboqRc=; b=xwOH8+NWikrFsbTxiNt18SPwgZRiyXp+O/c1EVyL4+dR7QzPvPN8XKSDt553DK/UF6 dcVsYvU9QzpkwdXf7keozroHEuhtrcz86fFXn/kkr+qK3bAJe7hdk6uicJkawfY3CxPn jfeA/QvFJAD+xNXYo7PbKLpw0kFG6/3uVBScxXzZEPD2s5CniwEOvyHtxVHlMnMrl8BR mPQRd3sitKKrEstHg4k21+wHzRdNWS0c8PZPMYeo8I2QaaS+0Um1ACRbpuIQr3FvNlIA NQjRdMXiUYhhOPbNcaQtER8dnkZryqWl1CWyFyQMc4n8xNkCcbvCiRb15hcRC+JzdrD4 xpsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695647883; x=1696252683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wxw1p33YOE1Wx3IdS6/yDe9IgDNF8zci3+vg+kboqRc=; b=BB+zupt6axtQvmGszA8CPLfyjKDqKbo3uv/rKFGPdN2Qnl3V8qtOSMum5lRLlsgLB0 s+mxWEc0/9pSpJ/fH2j4kBnLPpKFsVXGvpbvj5bIZOuQf0WoBSdBX9FLDWGbbq6uZzea JEOxqrrPrM+Hk7PHdhc8SEos80ZHqX6IXFD85BskD2+5WLeJ0lKpLjh8rEGCAo4uM1+g d4YvDF6IldfruB+uuCh9KFd7Wh0QAa/Two+jnLjoxpKdkZ0Z49ulREsKt8CEbHj383wd 3fLg38MmpOkCQ6W5GHbC+DCgDNLriSyBdvIgS3egcwBsnnlAFo2lISdFwk1n3tGcnKzI lXtQ== X-Gm-Message-State: AOJu0Yxe20QJz0JT7+9ZXy6kicVIAYQKpcZOprxdys6BCYkg1rv6RROX GOfcyKP6z0K2xXEcC8KrpWRmiw== X-Received: by 2002:a05:6512:308c:b0:500:79f7:1738 with SMTP id z12-20020a056512308c00b0050079f71738mr5892894lfd.17.1695647883494; Mon, 25 Sep 2023 06:18:03 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id m29-20020a056512015d00b004fe10276bbfsm1823583lfo.296.2023.09.25.06.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 06:18:02 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , "Rafael J . Wysocki" Cc: Nishanth Menon , Stephen Boyd , Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/9] firmware: arm_scmi: Simplify error path in scmi_dvfs_device_opps_add() Date: Mon, 25 Sep 2023 15:17:13 +0200 Message-Id: <20230925131715.138411-8-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230925131715.138411-1-ulf.hansson@linaro.org> References: <20230925131715.138411-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 25 Sep 2023 06:18:36 -0700 (PDT) Let's simplify the code in scmi_dvfs_device_opps_add() by using dev_pm_opp_remove_all_dynamic() in the error path. Signed-off-by: Ulf Hansson --- drivers/firmware/arm_scmi/perf.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 9eb58df9124d..733c5ebeb555 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -787,30 +787,22 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph, { int idx, ret; unsigned long freq; - struct scmi_opp *opp; struct perf_dom_info *dom; dom = scmi_perf_domain_lookup(ph, domain); if (IS_ERR(dom)) return PTR_ERR(dom); - for (opp = dom->opp, idx = 0; idx < dom->opp_count; idx++, opp++) { + for (idx = 0; idx < dom->opp_count; idx++) { if (!dom->level_indexing_mode) - freq = opp->perf * dom->mult_factor; + freq = dom->opp[idx].perf * dom->mult_factor; else - freq = opp->indicative_freq * 1000; + freq = dom->opp[idx].indicative_freq * 1000; ret = dev_pm_opp_add(dev, freq, 0); if (ret) { dev_warn(dev, "failed to add opp %luHz\n", freq); - - while (idx-- > 0) { - if (!dom->level_indexing_mode) - freq = (--opp)->perf * dom->mult_factor; - else - freq = (--opp)->indicative_freq * 1000; - dev_pm_opp_remove(dev, freq); - } + dev_pm_opp_remove_all_dynamic(dev); return ret; } -- 2.34.1