Message ID | 20230305-rmtfs-vmid-fix-v1-1-6a7206081602@z3ntu.xyz |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1320643wrd; Sun, 5 Mar 2023 02:50:35 -0800 (PST) X-Google-Smtp-Source: AK7set91QF0lQAO5fCptzRgEWT485EEZijZPOrbEHU/aHGRFkk5w2sF4vDYJlU+AdCcW5Q0AZH14 X-Received: by 2002:a05:6402:34c:b0:4ac:c39b:8450 with SMTP id r12-20020a056402034c00b004acc39b8450mr7192777edw.8.1678013435619; Sun, 05 Mar 2023 02:50:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678013435; cv=none; d=google.com; s=arc-20160816; b=PqZe1A71su6ToPlSqSiulXqvB8ZuR8oMMiOU0AFYg6vtcaBQwUYxTJ4moT9IQWYao2 D4qQ9ckKSfCwmPoYbiQv7jx96nMgVPPbPzh0+rYcwIBWV5QUW15lSQG7sf92XGedB4Sb ebKTYvnuas0Qe1RYpW+rfLM4LMw3/VtE8u3whdlGwku7sX2ngjG5hRTT0D81IOuROQNV 3bS2eDEPnraaWyEIYhf2O8PM+n6DMYNfXd9L5VUlyisFQWb/vD5LK0NoEixntViFrm99 Tsy7iZIMwqZ7RXKLvC4lp0RaLt0FxxepB7gPW96Qm3gFIE4zJZ5nI3JD8GApXBa2M5lL vpcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=c3ur0I1zAtR3iTdEIaoEC+vpmuEDF3fjkwmDhb43iA4=; b=ShvVRejhoccyD784TBmWxX8XH8zFZU+42BK26quOh4MPpJt3hKAGYPSef23DgI9N/l RTeKh6xOftj2Q2aBkuym4+TPvHlDPbMc9/9NyfDAjM2hkooWPwDO7SdPFe3wG6e92uYL OeSQnf27catrxDQ8+BaOBhiOVE/OkbbwaN3mP86C+ixiClxClju/idFVj4Hqgf3bS9Sw gJaYccGuMEUPElVXd4OVMHMwqGiPnymzGRkq1KedM/2JBVBx9Ch7xyKRqm+f38blmgS0 qpD3eDf2wkHoER2bTsXEwVSSFYw5cVUIdi58P3J9ayop7v/9S5CPSpjCsbEDwkVAzYX3 5Oow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@z3ntu.xyz header.s=z3ntu header.b=eII+qwGq; 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=z3ntu.xyz Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s23-20020aa7d797000000b004adbb12b195si8146009edq.419.2023.03.05.02.50.12; Sun, 05 Mar 2023 02:50:35 -0800 (PST) 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=@z3ntu.xyz header.s=z3ntu header.b=eII+qwGq; 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=z3ntu.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229754AbjCEKdI (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Sun, 5 Mar 2023 05:33:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbjCEKdB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 5 Mar 2023 05:33:01 -0500 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC0A659D; Sun, 5 Mar 2023 02:32:58 -0800 (PST) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id CAB3BD2455; Sun, 5 Mar 2023 10:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1678012376; bh=8TpJ2RFG2fZxCQ3aiTLoKbjpY3Tp/zvX9uXiLM/4nZg=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=eII+qwGqhkCAMp5tSLM9EpPVeUHWQ5WFjqCQOPd8laG+n4CiqeejoFEsA4ytFM9dm VBTbJXaDVqLnM8j/KufitSh5k2Gwrs6fJFy5rwhKnfPjkUiorWwDVsIJXWy6GoIWpZ aIpzq5gFJsxamewFTyGrANszX5i/f1Pbi1YwbPnc= From: Luca Weiss <luca@z3ntu.xyz> Date: Sun, 05 Mar 2023 11:32:33 +0100 Subject: [PATCH 1/2] soc: qcom: rmtfs: fix error handling reading qcom,vmid MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230305-rmtfs-vmid-fix-v1-1-6a7206081602@z3ntu.xyz> References: <20230305-rmtfs-vmid-fix-v1-0-6a7206081602@z3ntu.xyz> In-Reply-To: <20230305-rmtfs-vmid-fix-v1-0-6a7206081602@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Loic Poulain <loic.poulain@linaro.org> Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Weiss <luca@z3ntu.xyz> X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1399; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=8TpJ2RFG2fZxCQ3aiTLoKbjpY3Tp/zvX9uXiLM/4nZg=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkBG/WIwFqGiCP08Av11dROVIBCpWddyUGN6I2C CN06B7rrOWJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZARv1gAKCRBy2EO4nU3X VsBPEADU3T/mVxhg7C/c/g8pjFRimH45ug3Bp+luheaFcvpcxCsSRvmYFthYjmeGNvZwYGMY6YN BkKrjoeFL+8HtFYvW0U4moHH3zbiRuOJABai/v3vpnJuPHYgZj3W/2PX3J1e9ZhsmemWHUMqahY s7DlGqnXjka9aGZCb4qionM1xLcRsfZcKf68eONBLATzY330LE9LajVcTIL785hagf6Q2aWjpXe 9Kn/trcLEssPgRVBpoVh6wpCGROISeUzbuC+l2RuekykmrAURjjLGYgADUwa5B0mm812NqlEpig 1psUD0I4gDBq5xcF2R5HLIAdT1UK6IFDmbSnRuh/SA/2B+FLJl882G6L7soHVn6qbkrsKDdUJqm DWEDeb2FhuhC5c1PBWwAYdavDvWYg71bZ+kQz/hkSAyo+FeDX2kXrHlMQlFpRFwcXRKALcDuswc I9Y+7NXiOmXT/ipJg7dt907301UkfhAVSDPFEA0M3LaDYTosYz2QAQUj2tIIvOlv1DrV01dQGed aij6sp0p0Qw+EeaYPGUF0NRf4d11Lm7oIs0q3paKrOFulRuEsOVusBRIeCfXvpEwqGvnekROFXS jRNwtdqezhIPcF+27+7+aSMDnUujwqCVgNLBu3gnfzaLZ+N1+xAMWFPWfXcwkVPbcF0UiJhxVoP WO963xoxXAXnVrg== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759524616291741074?= X-GMAIL-MSGID: =?utf-8?q?1759524616291741074?= |
Series |
Fix qcom,vmid handling in rmtfs_mem
|
|
Commit Message
Luca Weiss
March 5, 2023, 10:32 a.m. UTC
of_property_count_u32_elems returns a negative integer when an error
happens , but since the value was assigned to an unsigned integer, the
check never worked correctly. Also print the correct variable in the
error print, ret isn't used here.
Fixes: e656cd0bcf3d ("soc: qcom: rmtfs: Optionally map RMTFS to more VMs")
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
drivers/soc/qcom/rmtfs_mem.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On 5.03.2023 11:32, Luca Weiss wrote: > of_property_count_u32_elems returns a negative integer when an error > happens , but since the value was assigned to an unsigned integer, the > check never worked correctly. Also print the correct variable in the > error print, ret isn't used here. > > Fixes: e656cd0bcf3d ("soc: qcom: rmtfs: Optionally map RMTFS to more VMs") > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > --- Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Konrad > drivers/soc/qcom/rmtfs_mem.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c > index 9d59ad509a5c7..218397ab0c36f 100644 > --- a/drivers/soc/qcom/rmtfs_mem.c > +++ b/drivers/soc/qcom/rmtfs_mem.c > @@ -176,7 +176,8 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) > struct reserved_mem *rmem; > struct qcom_rmtfs_mem *rmtfs_mem; > u32 client_id; > - u32 num_vmids, vmid[NUM_MAX_VMIDS]; > + u32 vmid[NUM_MAX_VMIDS]; > + int num_vmids; > int ret, i; > > rmem = of_reserved_mem_lookup(node); > @@ -229,7 +230,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) > > num_vmids = of_property_count_u32_elems(node, "qcom,vmid"); > if (num_vmids < 0) { > - dev_err(&pdev->dev, "failed to count qcom,vmid elements: %d\n", ret); > + dev_err(&pdev->dev, "failed to count qcom,vmid elements: %d\n", num_vmids); > goto remove_cdev; > } else if (num_vmids > NUM_MAX_VMIDS) { > dev_warn(&pdev->dev, >
diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c index 9d59ad509a5c7..218397ab0c36f 100644 --- a/drivers/soc/qcom/rmtfs_mem.c +++ b/drivers/soc/qcom/rmtfs_mem.c @@ -176,7 +176,8 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) struct reserved_mem *rmem; struct qcom_rmtfs_mem *rmtfs_mem; u32 client_id; - u32 num_vmids, vmid[NUM_MAX_VMIDS]; + u32 vmid[NUM_MAX_VMIDS]; + int num_vmids; int ret, i; rmem = of_reserved_mem_lookup(node); @@ -229,7 +230,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) num_vmids = of_property_count_u32_elems(node, "qcom,vmid"); if (num_vmids < 0) { - dev_err(&pdev->dev, "failed to count qcom,vmid elements: %d\n", ret); + dev_err(&pdev->dev, "failed to count qcom,vmid elements: %d\n", num_vmids); goto remove_cdev; } else if (num_vmids > NUM_MAX_VMIDS) { dev_warn(&pdev->dev,