Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4593778pxj; Wed, 12 May 2021 08:53:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJy6j9KEVSB/pScXqA70HY4sXFFxd3IsEtJyawpOwFg/yvPoaf+ofe+xMCm4cY3dHsHFVm X-Received: by 2002:aa7:c9ce:: with SMTP id i14mr938996edt.148.1620834802014; Wed, 12 May 2021 08:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834802; cv=none; d=google.com; s=arc-20160816; b=t4plWRuqDV097ks3f1eJtQp2mHxRAEjO0quzTsXE6ctFIYgk23PJ0Q4OuZNkmWjWYO hZr3dwN5y8OhqB3yJB8a3Fn6rkPli24IQoRkrldJLqeqckP2UBjcdfRqF7A/rcNATXU6 dLrYsfZvKf0s8YoBoRa+lGTLwzK6HwbpbnsIDK6S7g24eDOiEfnL10dLZfFItbVyK0FU BiwEWboektZpTKKB8xFRO3GQhBUIt0S/aX8YxUSFtXCOexg1cKT85Igkew8UCQ51Ajfw mBtn8+da51eqWm/ldRMic3uG/wqchqJF3yYagilBAGpOdkNVGQzf6Xeg0xoZjAHmVhII PFAA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hG6VsyCBX7BQHzl0SEhs6bOqIyXD8vfA78dkAETr19k=; b=R4V2sjM+plPG0+V7IcYCcNN5VTLX9hqp8MNMneVfWms1JJs48vKjww8ar6UXW+NBJj 5vITU0FI9AZLbeO0drAruhtg4an7tDVkpa7WScLy8huJ70R5OYvhjeD/D2Imt5zUY1yG xXzNvshIKEM1GFgBpKMY+4qhjYiiVfg5ReMO4z0xlmnmLE1oK//mftTj40fSsBwZkpAq saRcbGslSA2qHFrGgznwe9H635/e84SKr687YG8Hsrw55LTNegjdTVG2K+gYtYRTg5G2 hdR61IdPv43CWB6f09Hoo7yXZSFe/WSu3wRZtJQleVuJhKwSyeVSbhnAQdveEqSVrt0k LSag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=whIdEaYw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z26si243741ejr.406.2021.05.12.08.52.58; Wed, 12 May 2021 08:53:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=whIdEaYw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234898AbhELPwu (ORCPT + 99 others); Wed, 12 May 2021 11:52:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:40914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234872AbhELPZw (ORCPT ); Wed, 12 May 2021 11:25:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6097F61482; Wed, 12 May 2021 15:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832251; bh=JwloACa9axXIauNZtkciFVzPby9Jpw543exXJriXTzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=whIdEaYwkkS2OpWqv40ueN3H8OnRE+Pt2LNIyFgQBVpo7EXpGh55oxxoamHCRZz5P KzZ3EzCkUtnLK/OS6QVQYjkBXzfKAL7OH+HuwNtufY/SIIxqQKqiJ3/l5NQ7SnlDq8 2OWoKnYa5913ylRnwyX2Gwo8cBpnn0HzNWi93F5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Elliot Berman , Brian Masney , Stephan Gerhold , Jeffrey Hugo , Douglas Anderson , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 203/530] firmware: qcom_scm: Make __qcom_scm_is_call_available() return bool Date: Wed, 12 May 2021 16:45:13 +0200 Message-Id: <20210512144826.514077862@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Boyd [ Upstream commit 9d11af8b06a811c5c4878625f51ce109e2af4e80 ] Make __qcom_scm_is_call_available() return bool instead of int. The function has "is" in the name, so it should return a bool to indicate the truth of the call being available. Unfortunately, it can return a number < 0 which also looks "true", but not all callers expect that and thus they think a call is available when really the check to see if the call is available failed to figure it out. Reviewed-by: Bjorn Andersson Cc: Elliot Berman Cc: Brian Masney Cc: Stephan Gerhold Cc: Jeffrey Hugo Cc: Douglas Anderson Fixes: 0f206514749b ("scsi: firmware: qcom_scm: Add support for programming inline crypto keys") Fixes: 0434a4061471 ("firmware: qcom: scm: add support to restore secure config to qcm_scm-32") Fixes: b0a1614fb1f5 ("firmware: qcom: scm: add OCMEM lock/unlock interface") Signed-off-by: Stephen Boyd Link: https://lore.kernel.org/r/20210223214539.1336155-2-swboyd@chromium.org Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/firmware/qcom_scm.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 7be48c1bec96..54ba2834e763 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -113,9 +113,6 @@ static void qcom_scm_clk_disable(void) clk_disable_unprepare(__scm->bus_clk); } -static int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, - u32 cmd_id); - enum qcom_scm_convention qcom_scm_convention; static bool has_queried __read_mostly; static DEFINE_SPINLOCK(query_lock); @@ -219,8 +216,8 @@ static int qcom_scm_call_atomic(struct device *dev, } } -static int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, - u32 cmd_id) +static bool __qcom_scm_is_call_available(struct device *dev, u32 svc_id, + u32 cmd_id) { int ret; struct qcom_scm_desc desc = { @@ -247,7 +244,7 @@ static int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, ret = qcom_scm_call(dev, &desc, &res); - return ret ? : res.result[0]; + return ret ? false : !!res.result[0]; } /** @@ -585,9 +582,8 @@ bool qcom_scm_pas_supported(u32 peripheral) }; struct qcom_scm_res res; - ret = __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, - QCOM_SCM_PIL_PAS_IS_SUPPORTED); - if (ret <= 0) + if (!__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, + QCOM_SCM_PIL_PAS_IS_SUPPORTED)) return false; ret = qcom_scm_call(__scm->dev, &desc, &res); @@ -1054,17 +1050,18 @@ EXPORT_SYMBOL(qcom_scm_ice_set_key); */ bool qcom_scm_hdcp_available(void) { + bool avail; int ret = qcom_scm_clk_enable(); if (ret) return ret; - ret = __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_HDCP, + avail = __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_HDCP, QCOM_SCM_HDCP_INVOKE); qcom_scm_clk_disable(); - return ret > 0; + return avail; } EXPORT_SYMBOL(qcom_scm_hdcp_available); -- 2.30.2