From patchwork Sat May 13 11:17:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 682596 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E779C7EE23 for ; Sat, 13 May 2023 11:17:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236812AbjEMLRz (ORCPT ); Sat, 13 May 2023 07:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236911AbjEMLRy (ORCPT ); Sat, 13 May 2023 07:17:54 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45C0635AD for ; Sat, 13 May 2023 04:17:52 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-96598a7c5e0so1757120066b.3 for ; Sat, 13 May 2023 04:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683976671; x=1686568671; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=euhYG7UmFZ4gFEHsm78E/8ioQyFx2y8WD2YO5H5bfA0=; b=XOzhvH6L5tg0Hjy7q3ga6oI2Takd4P9vhCcWRLiUhKKmUoj4KfpcWXa8NcygVxh93o xXWyW/zgLKWjRk56afPcFKV797KIxLpWO5VtEHIObM+yWL1wcJYOuiY20LXGAYz4UhPN TA53D6aCqdVX1LWb2sKQhj2Cei3lXGY8tnonJZMCimpB03FB0M7GQm0tW+Sn+AbojpJ6 vuNWh28WOqX9HTK5ybN/bQ5NZrr7RKvmb1R0TyF5+GAwvPg0gckb5jQMDNpLm4ftDGV1 wOn6AV1FHwxttUzpOFMFLFtuywUyjRIrBdPhoizpGws/8+YUPAp2jNO8P2NDN6ee3KXa /I8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683976671; x=1686568671; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=euhYG7UmFZ4gFEHsm78E/8ioQyFx2y8WD2YO5H5bfA0=; b=keTwC0y4SgFGGvy99lo+lxmeSIHYdfblnR6sUIB3DKhZyJLVx4GXBx8idvNESC0fO3 N29VmTv7DxGRIAivRjY+ncB/KlO0Sl1McNP9SsnjfhZoLrbuDUYykJCNlHo5Q/5F0IqB EmRh5kllexus/hXKbhx8KjBnMESLqSggSSpST8qtMzr6P4HMqvwALPMWTZ/0kbF+UgaB FoIk5NpTE+aUtbVM9QkSGTLtN9OWnqKFVfpD1W+S8PVoQgWqmYCKMeC+CZeHpxER5R/w kbyiGiAlfnS+sYIR134wqiA+V0qb2+IvE8prF1zzp90Z1WzN8EnvURFRPnwF/TLoluiP oHbw== X-Gm-Message-State: AC+VfDwL4HrENM8QMyk9SkT4f45Tint35TK5YbMsaddDgDkE98ok3ZqO l3rSOZhkq/gleX7A06aB/ZSC1A== X-Google-Smtp-Source: ACHHUZ5th0INGdsqt6ZfidlIFO302kHwqpR9jUAvSepDZHJpamodKonx+d4oPgAYZ+wZlW5vqZyV4w== X-Received: by 2002:a17:907:3d9e:b0:96a:bb6:7309 with SMTP id he30-20020a1709073d9e00b0096a0bb67309mr17167479ejc.62.1683976670739; Sat, 13 May 2023 04:17:50 -0700 (PDT) Received: from krzk-bin.. ([2a02:810d:15c0:828:a3aa:fd4:f432:676b]) by smtp.gmail.com with ESMTPSA id tk13-20020a170907c28d00b0094f185d82dcsm6580230ejc.21.2023.05.13.04.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 04:17:49 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Konrad Dybcio , Thara Gopinath , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel test robot , Dan Carpenter , stable@vger.kernel.org Subject: [PATCH] soc: qcom: icc-bwmon: fix incorrect error code passed to dev_err_probe() Date: Sat, 13 May 2023 13:17:47 +0200 Message-Id: <20230513111747.132532-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Pass to dev_err_probe() PTR_ERR from actual dev_pm_opp_find_bw_floor() call which failed, instead of previous ret which at this point is 0. Failure of dev_pm_opp_find_bw_floor() would result in prematurely ending the probe with success. Fixes smatch warnings: drivers/soc/qcom/icc-bwmon.c:776 bwmon_probe() warn: passing zero to 'dev_err_probe' drivers/soc/qcom/icc-bwmon.c:781 bwmon_probe() warn: passing zero to 'dev_err_probe' Reported-by: kernel test robot Reported-by: Dan Carpenter Link: https://lore.kernel.org/r/202305131657.76XeHDjF-lkp@intel.com/ Cc: Fixes: b9c2ae6cac40 ("soc: qcom: icc-bwmon: Add bandwidth monitoring driver") Signed-off-by: Krzysztof Kozlowski --- Code was tested previously with smatch. Just this test in smatch is new. --- drivers/soc/qcom/icc-bwmon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c index fd58c5b69897..f65bfeca7ed6 100644 --- a/drivers/soc/qcom/icc-bwmon.c +++ b/drivers/soc/qcom/icc-bwmon.c @@ -773,12 +773,12 @@ static int bwmon_probe(struct platform_device *pdev) bwmon->max_bw_kbps = UINT_MAX; opp = dev_pm_opp_find_bw_floor(dev, &bwmon->max_bw_kbps, 0); if (IS_ERR(opp)) - return dev_err_probe(dev, ret, "failed to find max peak bandwidth\n"); + return dev_err_probe(dev, PTR_ERR(opp), "failed to find max peak bandwidth\n"); bwmon->min_bw_kbps = 0; opp = dev_pm_opp_find_bw_ceil(dev, &bwmon->min_bw_kbps, 0); if (IS_ERR(opp)) - return dev_err_probe(dev, ret, "failed to find min peak bandwidth\n"); + return dev_err_probe(dev, PTR_ERR(opp), "failed to find min peak bandwidth\n"); bwmon->dev = dev;