Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7814614rwp; Wed, 19 Jul 2023 00:09:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlGbXVQCCMYkWjmty4rLLW+vc7o2VLTL34GFGiglBb3dSmiyqU+Uy9heDHo4mrefU7LePQtN X-Received: by 2002:a17:902:e743:b0:1b2:5d5b:e871 with SMTP id p3-20020a170902e74300b001b25d5be871mr4114870plf.59.1689750591362; Wed, 19 Jul 2023 00:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689750591; cv=none; d=google.com; s=arc-20160816; b=R431So8/ovQouE3kdqoebkTHI259k3gQtQZ6Piygun67PtVwZSprvKuLzZUrt53D3S dNWqP59SnRGiQGFpXBwoHIHTNchFnXcalDr9zVeMjBAwq+lUYTBItHuEW0gOKzCNDYks 2C13fjdioO8wmaFEXtro0grOkJx9wFJGHDh4DR5wJcEfl4aQMpQNc+IwKZDtF4OXXTR5 P0viBgBrGZodgRbwRRVIBbMIvSX+Axij2ZZw/7BdJmJEog/SvMtnlFCPth1W8LMt8cva VcKAnD2kLiysaeF+/0qqwFd4ntW8P85VbyZW25doun5XL4s2bMQDafLe9W6oLj9Zf8bL vJ6w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=/3D3opjX717GgTUWBiU+QHvEZYFXmjd+9qv4cSuPkuA=; fh=yb2lMljvABaq9rYojpYe706yWqHq4Urtbnt6pkZIAS4=; b=ZezAsUMZHBedh+PAjW9c9NF8J3tp8CzVfTHUaI0gKdcDswYi8P7z8gn1M5fzkLuQVU 3Xit/rVVTZ0a5syBTnBqA/OcfwjUIQZrDYJCXitLW6yfnVcj7mqy9u73U6R1/PT/ZkO+ gjJna9uQFrnEhKw/mYjLRV8A/XH79R4/cGe42/HL+ARwoycrp65SQHnUFI7mtBeShCYD hU4jVMK+YIq/TYK3WSZp95GwizqB7mklM3JFK8hX5Ioc/7DgtapUR8BFZrlAwNg2Nm5K +Q9QRr23J6xPBXC/dS/9b0VhXvP/MRCjhqBSIpxhhQGSKQEtIV3KLch605j8ggrQxPPa CTrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fmSOGHZS; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020a170902c60b00b001b7f4696a2csi2834621plr.347.2023.07.19.00.09.35; Wed, 19 Jul 2023 00:09:51 -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=@linaro.org header.s=google header.b=fmSOGHZS; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230517AbjGSGRT (ORCPT + 99 others); Wed, 19 Jul 2023 02:17:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbjGSGRO (ORCPT ); Wed, 19 Jul 2023 02:17:14 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FD051BFF for ; Tue, 18 Jul 2023 23:16:59 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-51e56749750so8884481a12.0 for ; Tue, 18 Jul 2023 23:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689747417; x=1692339417; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/3D3opjX717GgTUWBiU+QHvEZYFXmjd+9qv4cSuPkuA=; b=fmSOGHZSbHFsabRaN28Z7YjPrEHukqwNbn/mICX7gQ4RZ8tGRUjDs7n8zF05HOiOpT 7GsUHsd43WCALy5vq9f9JHqv9Mgp1IUjThZkb0NVtGarbXty4p3J0ygLvOzw0m+HJxIF Yc3OpMExpMeGRddyFjaj92TlieU9oGkcRv6WpUzmqfvtLKzxfkPq39F2ZoRbanBHEM/z 3f4OD37fwnbdM1rINn8mRU2c/uCmTbc5iVmZ20/RZqi98lat+QcIB6DRxZ1HV8R/nTi5 UlWhTvsbl5okc+Igl3YJGfiI+Y6RSmH0VzEAyKGsO+abEUB88Uvbm5fJwPpBIVSkBBX6 /Swg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689747417; x=1692339417; 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=/3D3opjX717GgTUWBiU+QHvEZYFXmjd+9qv4cSuPkuA=; b=FR3MFgVbw4GqGmtXZ4ppow7f9RuMMPTlJjC8V9JHIvV4XENZcAsYCpIXi7X5zg8Pp0 +aVSsz0Q4/VgdFZ/8tvQlN4XI1B2yUt+voyRDAT1OLlJcRGjUr4dMkHQfovk0ONqSKL2 EwxgOn1Gw5h0HIjiZYVkS6FfyR6NPbE8jtS8xzuQXdBVq11FpHMt56ZMhfEhCV6Yni3K uDPcHITP+M6AEb5UN6wyJ9j4SOeqpJz0ozze7daB+PnX96LcyIisKsHo4XQmbt45pGeW toSTc+DOuX5sXLQypEBUucQ3TMdrlhrp2rk9D8R26fA8RLT22Qpuj/jHSjRw5FRaUlLx 6vUQ== X-Gm-Message-State: ABy/qLZ8F8F2Cu9Pou08TV5pzKzbEdQ4bMuC231FOtOubkIW4PG6e+q5 FESZXk/XUu5ywK5E9ZDcfcogGw== X-Received: by 2002:a17:906:7698:b0:986:f586:b97 with SMTP id o24-20020a170906769800b00986f5860b97mr1778494ejm.59.1689747417591; Tue, 18 Jul 2023 23:16:57 -0700 (PDT) Received: from krzk-bin.. ([178.197.223.104]) by smtp.gmail.com with ESMTPSA id w24-20020a17090633d800b009935aba3a9dsm1864576eja.48.2023.07.18.23.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 23:16:57 -0700 (PDT) From: Krzysztof Kozlowski To: Sudeep Holla , Cristian Marussi , Florian Fainelli , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH v2] firmware: arm_scmi: drop OF node reference in setup Date: Wed, 19 Jul 2023 08:16:52 +0200 Message-Id: <20230719061652.8850-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 The OF node reference obtained from of_parse_phandle() should be dropped if node is not compatible with arm,scmi-shmem. Fixes: 507cd4d2c5eb ("firmware: arm_scmi: Add compatibility checks for shmem node") Cc: Signed-off-by: Krzysztof Kozlowski --- Changes in v2: 1. Correct also mailbox.c --- drivers/firmware/arm_scmi/mailbox.c | 4 +++- drivers/firmware/arm_scmi/smc.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c index 1efa5e9392c4..19246ed1f01f 100644 --- a/drivers/firmware/arm_scmi/mailbox.c +++ b/drivers/firmware/arm_scmi/mailbox.c @@ -166,8 +166,10 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, return -ENOMEM; shmem = of_parse_phandle(cdev->of_node, "shmem", idx); - if (!of_device_is_compatible(shmem, "arm,scmi-shmem")) + if (!of_device_is_compatible(shmem, "arm,scmi-shmem")) { + of_node_put(shmem); return -ENXIO; + } ret = of_address_to_resource(shmem, 0, &res); of_node_put(shmem); diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c index 621c37efe3ec..2d8c510fbf52 100644 --- a/drivers/firmware/arm_scmi/smc.c +++ b/drivers/firmware/arm_scmi/smc.c @@ -137,8 +137,10 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, return -ENOMEM; np = of_parse_phandle(cdev->of_node, "shmem", 0); - if (!of_device_is_compatible(np, "arm,scmi-shmem")) + if (!of_device_is_compatible(np, "arm,scmi-shmem")) { + of_node_put(np); return -ENXIO; + } ret = of_address_to_resource(np, 0, &res); of_node_put(np); -- 2.34.1