From patchwork Sun Mar 5 10:32:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 659013 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 AC4F0C6FD1B for ; Sun, 5 Mar 2023 10:33:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbjCEKdD (ORCPT ); Sun, 5 Mar 2023 05:33:03 -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 ); 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 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 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 , Bjorn Andersson , Konrad Dybcio , Loic Poulain Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Weiss 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 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 Reviewed-by: Konrad Dybcio --- 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,