From patchwork Tue May 30 23:36:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 101153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2535287vqr; Tue, 30 May 2023 16:53:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4LCq9KyDH8tsdAs4k9GlqPREOa58+V0N42/0BAFFGIfQobrrLM5tb2JTUXzR7A80vquFyO X-Received: by 2002:a05:6a00:16c9:b0:64f:835c:a9ff with SMTP id l9-20020a056a0016c900b0064f835ca9ffmr5746083pfc.12.1685490819804; Tue, 30 May 2023 16:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685490819; cv=none; d=google.com; s=arc-20160816; b=y+eNCFeZSuoTcLmoV6tunI0yifFSA3k7cwdSm1zItiPJn2Ydn8SZ9oT2W541Kvv3x1 8uvpiFRFun0eG0u+h4ajsHj4j2Q0JEvHXlhxB/xyLMrwdVapXHmP6Foqc3BGRWk0eoLi MlhQzSOYob1iUMN3QS0nwKVz2NuEyGCUWuEqI5xFH6Fb0CqF+ecH7JcXlE4OzU16tzzA v+JpsyrBGu8lBskXYugar2+ss/jReXVmmDIkR67iI+9Ow2O9WwOaaHeAkVmhspR/9sLh sP9M4mIJdn3r36XseAL7Sxtitmc4/YLQGpVv5DCJaZ40X0RL7LRzCGHNR9mKE7Hct4aH r1lQ== 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=qPSZiIgCFceFazehkUzE7aZRdYowN6+xUI+qlLpyzz8=; b=0XSg0GI+pXtuLOrhTpKmLDKi6UwqmzTB59/FeEtYaRqMwA0130w19SIzz0JH5iCjxA Ks7nlMDwU5VYCsfRPZq07DMHJiAKxQ0qm88ZahjS1MVfOZEFzIOwpVe7gOBxeWJId5Px pfbPnjfb2FqvmkXjXCeHPLqN3ZrkxfclnJPQ+aPVc1f8RsS/aNQGftKdvT3VLt2yjMNS i06ZNxwdztsBNtt8gP6bTopOSlOSWP56bjWL7ZD8kAuYBdfWZZGdQm/1DXgS78vAhvE6 nV4nfAUjRzu3EDxcHYpSeEs6xEF9BzxNkoWmZMkrnrdYhtXeUVGha/sMo476TCwk1Wvn rC1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=QFdikKn1; 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=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v6-20020aa799c6000000b006489d6fa83fsi2506003pfi.142.2023.05.30.16.53.28; Tue, 30 May 2023 16:53:39 -0700 (PDT) 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=@quicinc.com header.s=qcppdkim1 header.b=QFdikKn1; 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=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233879AbjE3XhJ (ORCPT + 99 others); Tue, 30 May 2023 19:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233029AbjE3XhA (ORCPT ); Tue, 30 May 2023 19:37:00 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42652107; Tue, 30 May 2023 16:36:59 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34UNGt45003635; Tue, 30 May 2023 23:36:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=qPSZiIgCFceFazehkUzE7aZRdYowN6+xUI+qlLpyzz8=; b=QFdikKn19y1Bv0kcIVdpWgiMHW8Ew/gVMOvFOwma0qLXYg5na9LTgY0h67youKn0/fFT P7iZxZ3fytdsH3Kg4avX2bc0iwQJ/khyNyG9Ou0XB+k5l61hLA7K2Cmxoz7S+cnCNvgV BNn4CIk+Q/WosVgvH3KgkBJfZvMdP/FPjhNhdslUM5hMJ8qqxw6rqTQnUmEz4HiKY6Ue 093CRFhkZjBNIX8KzYJn/FnCWXs54fQLuu9ParhBdiV+H14FFLFvHVdFHY5tIBOm514s WJX7ieqyBqmayUasmLelU5IZg7TDSL100ERi8Vtb//YuP2AotDQRwhR6he0xBOPnpIzc qA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3qw8v4tbfq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 May 2023 23:36:50 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 34UNaooJ014641 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 May 2023 23:36:50 GMT Received: from hu-bjorande-lv.qualcomm.com (10.49.16.6) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Tue, 30 May 2023 16:36:49 -0700 From: Bjorn Andersson To: Bjorn Andersson , Konrad Dybcio CC: Rob Herring , Krzysztof Kozlowski , Conor Dooley , , , Subject: [PATCH v2 3/3] soc: qcom: rtmfs: Handle reserved-memory allocation issues Date: Tue, 30 May 2023 16:36:43 -0700 Message-ID: <20230530233643.4044823-4-quic_bjorande@quicinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230530233643.4044823-1-quic_bjorande@quicinc.com> References: <20230530233643.4044823-1-quic_bjorande@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 8sC1niehEyTMmkS9m9iHlIm1tTyOaNI9 X-Proofpoint-GUID: 8sC1niehEyTMmkS9m9iHlIm1tTyOaNI9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-30_17,2023-05-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 mlxlogscore=823 priorityscore=1501 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305300193 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767365222128796284?= X-GMAIL-MSGID: =?utf-8?q?1767365222128796284?= In the even that Linux failed to allocate the reserved memory range specified in the DeviceTree, the size of the reserved_mem will be 0, which results in a oops when memory remapping is attempted. Detect this and report that the memory region was not found instead. Signed-off-by: Bjorn Andersson --- Changes since v1: - New patch drivers/soc/qcom/rmtfs_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c index 28238974d913..e3a55fa041f9 100644 --- a/drivers/soc/qcom/rmtfs_mem.c +++ b/drivers/soc/qcom/rmtfs_mem.c @@ -180,7 +180,7 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) int ret, i; rmem = of_reserved_mem_lookup(node); - if (!rmem) { + if (!rmem || !rmem->size) { dev_err(&pdev->dev, "failed to acquire memory region\n"); return -EINVAL; }