From patchwork Tue Aug 13 13:09:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 818892 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C56919B581 for ; Tue, 13 Aug 2024 13:10:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554606; cv=none; b=kyxp2bZdFESf46JxdM76lRLuGv5+CM9+9r9uJKeUib8q/9KR4jcKYhEketWh+VzJr8najqYBB+0tyCOiWFbKP10XLVhKHWb+H1z1RB5DMlsN+gXmZUqYmbwbeYa4fCUjzt70FRUBWip56/FqQYrQm0yktBsp8RdlJk6SylDlfNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554606; c=relaxed/simple; bh=BwejMU6ZUIgz8lGX+Skc7VtQTPN1+y9vWUPFbkYCZ50=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Y5ZX3HVCw5/rAHVFbN+SxJ5lDU06xlF2a+SDhI3AFFtCDK3AKss6A3eOuRGWGWbIKu6OSOaY9jnWk0O56zKU8/YoYytvgc09lZ0vixDoIBPgQUlZMepODXYyneT7iopeDziTle6x771Vmv8R2ocIYL8o3mu6mkmutfjuYhQlTlQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=YmJiT4p9; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YmJiT4p9" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-367ab76d5e1so2486878f8f.3 for ; Tue, 13 Aug 2024 06:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723554602; x=1724159402; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vYV2yBaiU1eNGbD5nUDJdPAfLsrnpN3FqBevnmPD6R8=; b=YmJiT4p9Sksy3//JzDs6wwKUuycBR+SK82sG0RfK2JmwVyF3EMZDzxUw7ZKOf4qJF4 Ok/Dj04HCTkoZXT7j3v0aLE+5OQ8uvqYrO2Xg+rbkXkORQArOs8yDUEqB6oQ0PFB5gem v5AUCQeIZFZGTDY3Z7Spf8Oudo6ey0yX62nesqKv14nyUqNacyNi/cEKswntuzaxzzHB qV6FxugPS0mY67nkaMREXZ3wAslhRxniKttXmLFHiR7g0GRuiugA7iMaS3Di8doMPkyE gcdjeAiqhALhqY4GCm+gdqKmbkHoiRBuKvg5EF7yXiEIahjo005TAvKnkZJhoplbePoa JsKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723554602; x=1724159402; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vYV2yBaiU1eNGbD5nUDJdPAfLsrnpN3FqBevnmPD6R8=; b=FIpKLJ1hTQda25K2QO8fIj/C908+sDKedXr7SgoCqZ0GVCGyrABGIwGYaNx1/Oc/bT cDHHZviSalgDJ7MCTvsfG8/zDYxxk+PxqC00mgNrIMkRGCv72EYceetT1K6NHYuCWS/i E6dLMUJI6WagfTTRx6XHDoEIDx5pxRXhp7uWcPpZ0CTYcdQRKVHqy1O7VUnhSe1bvnuF 18cNApSgm6PYODC9J7bh3uqXi135LPgCOY8IQ89M0QdOrjKMwlWdYjpxJID2e7oBQljW C5Cv5D5BqGEKkX3B92n1M3AD7v5QICsGO0PJDuG/wW3/u0eow244wreAtSMltPt3VMrE ELqg== X-Forwarded-Encrypted: i=1; AJvYcCU82eA8MvFdZrbo3OBj99vLgIxsfDsLAQEeAU3O3Vt9BYJI5CT7oHJsQf9VW2DVKNsmMkPqPypyzFG/We64@vger.kernel.org X-Gm-Message-State: AOJu0Yxr4dHG/AsZz6Sb5SCvGPR7qUQ4uVJMt7iH6RVgRd65OHrv27pF TtGLbuhTLxQaSIl9S63tXj4mE/afbXBi1DsVTLs9RpcrI+wGoDU6gUwdclOy4MY= X-Google-Smtp-Source: AGHT+IHEtXM/0I0GAyREg5EKER0DYF7+YSxuj3da4+f2SEaAk7GsANHFPwX5vhUb957YGIRTjSasUA== X-Received: by 2002:a5d:6dca:0:b0:367:8aa2:d41f with SMTP id ffacd0b85a97d-3716cd32235mr2372644f8f.51.1723554602500; Tue, 13 Aug 2024 06:10:02 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4c938280sm10305003f8f.36.2024.08.13.06.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:10:01 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 13 Aug 2024 15:09:47 +0200 Subject: [PATCH 1/6] soc: qcom: apr: simplify with scoped for each OF child loop Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240813-b4-cleanup-h-of-node-put-other-v1-1-cfb67323a95c@linaro.org> References: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> In-Reply-To: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> To: Srinivas Kandagatla , Banajit Goswami , Bjorn Andersson , Konrad Dybcio Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1394; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=BwejMU6ZUIgz8lGX+Skc7VtQTPN1+y9vWUPFbkYCZ50=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmu1sf7WFjqKtqbnO/o4IKv/eNdOe1rxw8n+MXW V6xxEWEnqOJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZrtbHwAKCRDBN2bmhouD 11T1EACOn5uWT6CrmTfB2xyhTbC2MNwPQUICTvz64hAaEmeUl7lnqitjw4SEnJYJ7g5AMu7kt/e cNiVSP7xKl/6h5qbl0u1wdaQNPlhQ4ateDxP+X5SQBN5kSsuWcOzAENTBZupjo1cFhOYOa9X77A +8DMfXJZznJcMzWfKHVN/spGMyvGablCdileKkoJGtjYmhmWThN7D9z42+QB0du2e921go9fMzp Io/wsmtWzimOd4E08/JFiVoK9jeoKATne2GYbJTvyvSn/XKAt662X8UFSm9Q1Elna9HyeVZLk82 TN9LoFNn1K/XG0+08mhyxuNTMFc+B2/8zt34OWIR0VOFSunlh4PIZzgP0WA+ChjHNc3gLSH7lGH O+pxC3ks4aUqOdmvt26XBse1wvzcLh6gx4vR0YJA/8oDETijzhBqtuvZqElb/GINXmYhLorCCQS 4VySRPgKG2obt6y9zPps6U2ex5Z/5TrFFbmJSCM6fKZ631hyVczy76QG6nGkx7VtV3fZhbDe7/s Y8dEc5TCSMJd4W1DgezIzxeDiN8mF87zTJ0oj5uD6B0DIueTahdu2JlTCCxqow2FJim11nGrHS0 rUmI4XjaXCPdZ4buW/dGENZF93AyP0GtONfuKIKUcMnCSNpB1IdvcAzQyfjBLEVTLfWO2sIJrps 8S+vyqL5BNINP2w== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/soc/qcom/apr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c index 4fbff3a890e2..a956c407ce03 100644 --- a/drivers/soc/qcom/apr.c +++ b/drivers/soc/qcom/apr.c @@ -485,11 +485,10 @@ static int of_apr_add_pd_lookups(struct device *dev) { const char *service_name, *service_path; struct packet_router *apr = dev_get_drvdata(dev); - struct device_node *node; struct pdr_service *pds; int ret; - for_each_child_of_node(dev->of_node, node) { + for_each_child_of_node_scoped(dev->of_node, node) { ret = of_property_read_string_index(node, "qcom,protection-domain", 0, &service_name); if (ret < 0) @@ -499,14 +498,12 @@ static int of_apr_add_pd_lookups(struct device *dev) 1, &service_path); if (ret < 0) { dev_err(dev, "pdr service path missing: %d\n", ret); - of_node_put(node); return ret; } pds = pdr_add_lookup(apr->pdr, service_name, service_path); if (IS_ERR(pds) && PTR_ERR(pds) != -EALREADY) { dev_err(dev, "pdr add lookup failed: %ld\n", PTR_ERR(pds)); - of_node_put(node); return PTR_ERR(pds); } } From patchwork Tue Aug 13 13:09:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 819532 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 878D819D075 for ; Tue, 13 Aug 2024 13:10:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554610; cv=none; b=VF3StAhYsl/aYb/R5ve7lwY1DeG2ToE9XSMraVhv1eqWPO/KNgvbcYCn1ea+lbZ5vHMElcd9HHzmm1jXmYgh5l0ymwU2Ua1No2b+3SHazxZVGjQyGc/D8b6xsVaxf48s4/FVq7sxXJVVPY5qc79Qevjg7qBXYVEG+IRkOeLOsTY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554610; c=relaxed/simple; bh=5ke0dMugQJGUNzUanoO5HspavxzPQnzSJYizcfymtG0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rqaPmgJEcuJg75UTZWOu6+7CJ118JCSWLXSQ5DgQ5r05bxlDcUYFUNJS5DRwTrZ9tP4hgRHj+vVK7X8HwdRWTozC+JCW9dpfS1DdAgQaDjeJyh/kHlwCpkARTPblAl+QX3cBM0SMIc+bj+OGmvCp7o67/o15G3xoSMWioqCSqic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=U2lqZ3iS; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="U2lqZ3iS" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-42816ca782dso42125225e9.2 for ; Tue, 13 Aug 2024 06:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723554607; x=1724159407; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=m2fVMcPJnrUO0N/1FseA0j+EEzz4Wl9hBU15LCUQqrw=; b=U2lqZ3iSYtjgZzBFr3/gVOKD9OjXU9yg6ZITyNDD9RayRdnafgXHejP5hrOYUZE/OE vm0i2QDb+tnzq3ZQiKwX5EBzjNC9zD2Zdv0Vqj7gvaa+uTA1hFwjnZNkpm1DUqZjRHfR 2c4i+wypaSgAdt6KI90DQJB4e1JAaRPwoePJixhvuUuhKJz5srcQEbWA3oJXct4efKVe qRQQo5QIuqi1oTIflRJPXFK3hUvHj32DR+Wv1L62OwjASks/QLXYSLn2u9PrEWiXBm/S 49xfh9PIi23SY4qmC56Y76xdNNqw4KEhgdQx3DG3XLzwD42QMCQ9nBw79yLYCKVXs879 9hNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723554607; x=1724159407; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m2fVMcPJnrUO0N/1FseA0j+EEzz4Wl9hBU15LCUQqrw=; b=tWCZsXywhS3cFkqbk9JrEPC+ip6OBoy1l5yvUX7u8fXGpGOSUivTMMLrkitkzBvDDQ cU1oE+cru6zdN2EUq/i9Noo2TrFyQMtjItlDyjrAPfilVpqfXVNaJ8RbVKyOEFYGC3UL OROQX3GmUmBYss69VxC20k9PNw6ECUWddmbiU1GaCZKnaR69JUqv4UfFM+6dqB6xSmj2 MoTlA/nrshC2F7sVypy+hCFE1/fUPRIKOwKaLcvK5idJqV43Tk2pU/IsJ9hJOiLoOMhm 1R5sRWp7qTHcAzln7Yk1TsLQpdINaYo437XtKIUXK3cvl1FN64wHiI1rFs2Dju697n/A kPDQ== X-Forwarded-Encrypted: i=1; AJvYcCXpd7BkGVUZTN5qZG34XH3rp74Ste+abZH3yqMSuuQGlqfD+v3Y1tCi4OMRaQyTXx1gQYXnRO523rj0talL0jbt2Tn33XksH8UmLlatdQ== X-Gm-Message-State: AOJu0YwqixVvgy8Ka80aZDRsu4RMgRcbuLHGJCLbt45ds7v40OJltZc1 6RHrnu4y3k95pt/ejZ14YmuF/HgM2tpbHGWNoYdBMA1RSiYEPos0/n+54ZEd5PU= X-Google-Smtp-Source: AGHT+IHnqwXc38Pnpsch22i4e5wNnLg8t3Sw8H/kb30baBblrfe0Ww0kSwLWvg9YlxY932elDZZEiQ== X-Received: by 2002:a05:600c:4e87:b0:426:5216:3247 with SMTP id 5b1f17b1804b1-429d47f43c5mr23464765e9.6.1723554606909; Tue, 13 Aug 2024 06:10:06 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4c938280sm10305003f8f.36.2024.08.13.06.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:10:03 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 13 Aug 2024 15:09:48 +0200 Subject: [PATCH 2/6] soc: qcom: aoss: simplify with scoped for each OF child loop Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240813-b4-cleanup-h-of-node-put-other-v1-2-cfb67323a95c@linaro.org> References: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> In-Reply-To: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> To: Srinivas Kandagatla , Banajit Goswami , Bjorn Andersson , Konrad Dybcio Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1215; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=5ke0dMugQJGUNzUanoO5HspavxzPQnzSJYizcfymtG0=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmu1sgzubjFvDtLJ+b01jNRFC9A7/wMsKAxjAK7 lgCKP4SyxuJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZrtbIAAKCRDBN2bmhouD 196BD/9zpchJcYbVKVBPCCQYSew98k1x7YKbjCYqEkr2Rl0ry5Q0WsDrLcz+OdPNUNcukEBF57j CXFMVHwF/8HziV4YUQ+g/pJ9U+XQc8ZK9yVd2j0rCdKtFoGDJaH5jt1tt5u3XA4enR93eAScbBp z5WdEHG801tqydGLxgY06YsKKBo6TyNl6M58T8DmY9j7zNUnfPDB4tuGClf9vBycT/Jj/O/aDDn 4QbR/52niOyRHJJKNAtssir5m7I01na6FAKy0FVCubov8ranFGxpB+/eajBWSPKCy+TJOcip70k hQncmCZ9UA8CWvAfa7Ge7tHs+apnqGQYhF5dIcyXOC+EXRFuxZSs2aP7RScesHW7NT8kC/d6YPn UWiIShbfEkndLogb4uVBxCHY+lGq1TuD99bQBA1263enla+ziujq2XHmClw9Jwh0e/ehzJx1lvz O7NJaGTbSgIpaaVcS772jGuCgtxdjipcFWZnGxeuLqX4cWUfLtB+kDlroZf/+gN89t/1BK9OKln aicspz5G8uvst1BkIlyPg6YrTCv9ays26lhb7+QPmKuiMERxXiVu+6NnCTN7Sh/xjB9Y5CZ5fig jo1h802DvOHu9aslkYrUjJBkngQvLMPXfU8SCQqMwdfkByy46tYvfiN0YL5C02pRc0+Ww98lSNJ QfesZwWWNe6o9nw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Use scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/soc/qcom/qcom_aoss.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index ca2f6b7629ce..60af26667bce 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -394,7 +394,7 @@ static int qmp_cooling_device_add(struct qmp *qmp, static int qmp_cooling_devices_register(struct qmp *qmp) { - struct device_node *np, *child; + struct device_node *np; int count = 0; int ret; @@ -407,15 +407,13 @@ static int qmp_cooling_devices_register(struct qmp *qmp) if (!qmp->cooling_devs) return -ENOMEM; - for_each_available_child_of_node(np, child) { + for_each_available_child_of_node_scoped(np, child) { if (!of_property_present(child, "#cooling-cells")) continue; ret = qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++], child); - if (ret) { - of_node_put(child); + if (ret) goto unroll; - } } if (!count) From patchwork Tue Aug 13 13:09:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 818891 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AA6519D07C for ; Tue, 13 Aug 2024 13:10:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554613; cv=none; b=uoqUelm/4zHNo2TDBQ43VJ9ZArM+UIZwZkd4Q6aRD2ImqjlWDxwKT1lnw30c3jfTH3MVtghCHH9KpKMZy0lNEdOT70wR9pohhiHBOa7hmeOqTijLA0ZIno3X7HPs/wtYhN33nL9BmLqAFROYpy/vFlrCfA/erZKQEFU4BTh5AV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554613; c=relaxed/simple; bh=wSmKVeR5KDA8zEAvS740eQFFBkxeMJlrEwsk0nEhwQs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VmPhojcQ41ONmlswIs6QpXwbLG2Q6uGJ4sa5Yuv5i8P6aEMdE5jBsvCAxpS2uVW2gtiT5nheqdZonVm+qVigiHiUJZUW2LEATAMdQ6ujhIqUzi6xcpTKomRVF9Qnx0wqwpwPpJht+cl2hRvxZOzbOyr8wW6nr6xFgPH9XG4cucQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=tIzO3voR; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tIzO3voR" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3687f91af40so3351587f8f.0 for ; Tue, 13 Aug 2024 06:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723554610; x=1724159410; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zOfeSktxxxx+AVaDkIgX6QSMwS92sXS03dIKp1uUHmM=; b=tIzO3voRDZd5LGF+bMb0Y+StJAkLJOl3ufji7VCZvKo11EoNqhC6YgTabn5W2HAw3+ IafD0AOZz1xbkvaPun5slYYlcMtGFLHiK2lI9ym8p3LFitPD+EYN4DymmOUFXnWOIVAt 9rFBTu4pN7gamGdAUY1m5SFgMEiYdL38X7dh5M/qEtMS8FujmOtg9h/tHaA4yx+//2Kf IA6OEz8CzTWfZMeyPKyi+G+ZEApW9/1xa82ZKGExpXkOFnUdKXvAlAVZkUUcAY5UV6/A cfKG5ZrdsnZS4t3ws/2Waw7vwvoRnuB94tuGb0h04DVFQelqfMw8Vb4W0CuupN+HLd8m AkvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723554610; x=1724159410; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zOfeSktxxxx+AVaDkIgX6QSMwS92sXS03dIKp1uUHmM=; b=tCSw4Yuy8lp3An2aCCB88DXpE65APjSzs3gNDY0hvt5A89B0RBzhU5MBdNsSJ8CVYw 170nkol+topHWx4fA0co5PVUy1UpuoeKoSNnj3bIZcKwH7/6D2uEvmGCl0z4fqFw6v5R Oo3nO+21zPHuk/77Xi/GxSkPTzwgoB6QGyGoknFllfsKR1lAF4PrAEL6jpyUDW2LJW8e /hcyorYpzfOGkbd9el80GdM1hlpudQhBXdUqXT73qeufX6LX3AwWhniiIyd6IxK1OT3Y l+Z6wPOextfcmvwRKvTOqz5YA3dJNtcGLkRbDo+UKOWzlemL7x7fAHXRKhrJJqG1DjZr ZgnA== X-Forwarded-Encrypted: i=1; AJvYcCU2nJ6671cNl3ubCf+gMJQh4VrdPbJMPzYE+ucgFgu1ry23nzEOOQtSVI/6qTNMla56UEQMRNdut/rLYloexeflvOMHCAxtmh+GWr9cDw== X-Gm-Message-State: AOJu0YzBphpqISa5iI4S/cmrlNOweRWCuIfcRLlRIeJQniha+e7L/OPe pkOQehIu8EYaWDxZBIEWvtQ/9kNQFohh3L4wJO88bZPcJeIkjAIzotDM4RlYaIg= X-Google-Smtp-Source: AGHT+IHyNEIn/w+Q3aUBV+ipIP0PES4tddwlwX5duA/1fo0cQCC6TltvLeRJDiS0zTmiMEeDz3hbag== X-Received: by 2002:a5d:4ecd:0:b0:368:5b0c:7d34 with SMTP id ffacd0b85a97d-3716ccf1e7amr2493850f8f.22.1723554609762; Tue, 13 Aug 2024 06:10:09 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4c938280sm10305003f8f.36.2024.08.13.06.10.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:10:08 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 13 Aug 2024 15:09:49 +0200 Subject: [PATCH 3/6] soc: qcom: ice: use scoped device node handling to simplify error paths Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240813-b4-cleanup-h-of-node-put-other-v1-3-cfb67323a95c@linaro.org> References: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> In-Reply-To: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> To: Srinivas Kandagatla , Banajit Goswami , Bjorn Andersson , Konrad Dybcio Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2089; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=wSmKVeR5KDA8zEAvS740eQFFBkxeMJlrEwsk0nEhwQs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmu1sh5LeIoKQcZBpw8Q0T7w56JOH+NskEVH9ts H6E4FxaqEOJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZrtbIQAKCRDBN2bmhouD 1+kuD/9Z/MncfojAYUJXJABsySNZGoAFTsvI5oTL/7lPqEhOofrokAIH8o9kLEi5k/uJ+XHxaeD HavJlDNe+CbSNA5hAFM9FDUqqK6X5JeYzasWTGirc6EwmKdPm285CAd2bXU5xOzsyWVYExOl3Y+ nwf/ombpgpleqhr6pcLkryzJ3yo4qQDokdW8Rdq03PWVRDPwyyrRKfBaOs5evJWJBITJMkE5JAe okxPARs5T0b9/lB61sg6aamuwLZ7f1o/MTUjf7ErpLEQQPQ3wnEr5B17HvMMhU97azGI7lVQ4DU 63f2I1gQyoiuQKOBisboJdn8Xx/9OGnpWxMwV3Ud28WlErdlklA9Iag0PG082BUr3kTl4y8qZBl 3gEfXyA87EsahI8JkQ8NrTdxtHfQq4+d+8QBNm5vb8gb3n584yqeqWwtSRdoTSHFfONvXWKv4ef RgpkDi6VWMqi2Bf6Y3F2FSxKvAyeFRwSFXwwwHuBDZUSvJzaOOeuryL6JyFA+LT26GsThf1UlHc B4voocpWUdw3QQ5DK4EnL2bdUlgq2X4m6rJbb6O2MzTuH2p3CrgSpNQfGgrQhk7PtYwD51T3Nzi fYmX6sCsEXg7kJErv6O4RS8B/zcsv382ZGl5XFV1KDD2ASKX5t+f1WT5sgJywP3EHQ4iX94pp9W fGM/J+iufuJEQcw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/soc/qcom/ice.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c index fbab7fe5c652..50be7a9274a1 100644 --- a/drivers/soc/qcom/ice.c +++ b/drivers/soc/qcom/ice.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -265,7 +266,6 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct qcom_ice *ice; - struct device_node *node; struct resource *res; void __iomem *base; @@ -292,15 +292,15 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev) * (legacy DT binding), then it must at least provide a phandle * to the ICE devicetree node, otherwise ICE is not supported. */ - node = of_parse_phandle(dev->of_node, "qcom,ice", 0); + struct device_node *node __free(device_node) = of_parse_phandle(dev->of_node, + "qcom,ice", 0); if (!node) return NULL; pdev = of_find_device_by_node(node); if (!pdev) { dev_err(dev, "Cannot find device node %s\n", node->name); - ice = ERR_PTR(-EPROBE_DEFER); - goto out; + return ERR_PTR(-EPROBE_DEFER); } ice = platform_get_drvdata(pdev); @@ -308,8 +308,7 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev) dev_err(dev, "Cannot get ice instance from %s\n", dev_name(&pdev->dev)); platform_device_put(pdev); - ice = ERR_PTR(-EPROBE_DEFER); - goto out; + return ERR_PTR(-EPROBE_DEFER); } ice->link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER); @@ -321,9 +320,6 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev) ice = ERR_PTR(-EINVAL); } -out: - of_node_put(node); - return ice; } EXPORT_SYMBOL_GPL(of_qcom_ice_get); From patchwork Tue Aug 13 13:09:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 819531 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C159519D893 for ; Tue, 13 Aug 2024 13:10:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554616; cv=none; b=PyzekTAG/8McVGGQpsD6slBhSK+032JscODcZ2d7KFbX6UnD4qHmOjOWsV/Gc1etuz8nlK2TVkgS7S/K1WZ1PH1mbr9Dbg6lQZeIvytzzwxZbVg5SD3TnQQ0k9f2dQG7Q+HRfysvcTY1+VtKRJJsAx9Kd6uyVhTckMraucPk4Oo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554616; c=relaxed/simple; bh=YDxB0HgopBggQswhaM9Nf30/Wv6HgEPuB5MAMQDxXIs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ohK8HXSbK2VUUkxvLf6/PB2DUhzQAxWHrUspTuzbgo+U+m6nYV/6Y5JSMbLFoPlC3KRTXoGvrYFhKd3+Hv2wCm4ngzoCMfRbhp3ceHUt/7X+DrXwqUckVEA7Jpujq7My6kvLwcPKlRokK6OGYwU7a/Q8bPDlV2fYm5hW/kobDLo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=or/YwUTw; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="or/YwUTw" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4266f3e0df8so38580575e9.2 for ; Tue, 13 Aug 2024 06:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723554613; x=1724159413; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NvFqdgdGTLbeV2IBiZybZvZVviH6ZKLzya6Ui6o1+og=; b=or/YwUTwhGTQ0tCNWwCsHlPor0GBt4bhgDzuC0Di0kV8kJ+GIaeJo5aH9e++Y8lKea RDksK5BIu+pxWW/m7NG5Qmjoa6GodVTZU1hxqci0TnXaBslUdDut3fGQVrL3c8HpRxzj J2yR/iW0rZHtF+Bv6TFch/bnbtxh3KH8HnlRTFNkImro8xoEg90PS3z8y6DdKYGkt22D 2LtIyD4Ly1IEjDaCM4Q7SLG2NqfqpSzD5Ocpel2wmrUELrY2kLl7ipOnyUEDAsR9Epeh /SruHYLbRZ4amQQD0kbhCVhz1FYBugtj1d10dxdfiIcjONpo5xeZcXH3gz18hO5AOZOh iELg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723554613; x=1724159413; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NvFqdgdGTLbeV2IBiZybZvZVviH6ZKLzya6Ui6o1+og=; b=BInmEZKx2OFeStbidZg7sh3i3ojcA+rE2jy9NXWff0thtrkKxxhjnIpSxT57JLoqUJ A120O9bJGa/lMKvbaAuxbEvxiJOKlnWxKpGewCerIzOeVaAnB5AX/0Yo9RlEX4DxXW7/ VEmeHe1FVYMdlvEtrfidLrUgV0ebLUG/o4E9ZSHU4lUujhNo/HR7DtHLbd/3pAvPLcpG L47Rs/QtrxkV514TIkmXHR5xeVlz+T2+i+XUBZYjE/Vp0y0lhPF9X0f/zqZz0YyzWveV FbQOrZFUBKR7XgAAzy3qv0+ebbJF9NDEvwY2tc9o6ohmUdAZ7QkZmaPX6MRVxQ1RCV+H ejvQ== X-Forwarded-Encrypted: i=1; AJvYcCVdAcSeWzCfFvUTcoMigLVVuMXHzLgymH7pcF0t5rInmWN/Spt650rv1qWZETct1CcHVlM8v3H0INB5/O7JEKpuQGO6YzEGh5S1PwhZSA== X-Gm-Message-State: AOJu0Ywu/MZDuS39pgp9GlHDCasJ95IewFPzuZ4xt6mDYnwW6GALO+fz xnsCE2Bl9tm2uYYTy8/aOlXUsitWqwm/9cX+bpKzBAmherZWlSvO9QAvNsehBtU= X-Google-Smtp-Source: AGHT+IFr6R1DpWudIdK2UY1bOf6WYcFVh4iOEtSuhgiHZqcRCa0lqDw4BllFA19PwIX+96XPSVJgIA== X-Received: by 2002:a05:600c:2305:b0:428:e09d:3c with SMTP id 5b1f17b1804b1-429d48e7af2mr24961855e9.33.1723554612987; Tue, 13 Aug 2024 06:10:12 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4c938280sm10305003f8f.36.2024.08.13.06.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:10:11 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 13 Aug 2024 15:09:50 +0200 Subject: [PATCH 4/6] soc: qcom: ocmem: use scoped device node handling to simplify error paths Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240813-b4-cleanup-h-of-node-put-other-v1-4-cfb67323a95c@linaro.org> References: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> In-Reply-To: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> To: Srinivas Kandagatla , Banajit Goswami , Bjorn Andersson , Konrad Dybcio Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1306; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=YDxB0HgopBggQswhaM9Nf30/Wv6HgEPuB5MAMQDxXIs=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmu1siVHCQ20U1/0c3igZrQElWbBLRyATq9fBlN F+5zmuH+maJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZrtbIgAKCRDBN2bmhouD 1zbED/45WDZUHgP3RqB6w7yI2gsueMfYjV7TCCDzkdPzWodbwhKT9aOtyzZ8u6Nvu/VhqZ74CJn kgMTHSX2YZL4VHnkGRxfGRiw6TfagE2RDpkhmRlgg/55amHb8JlKBboZSID4mGP38knLAHuCr5d cFk+3m03hK7eWI352kn+S1JREEdN4Pjf8M1nUpeMBMTepZYnsPZqBQwuYUL36YEyw/h5SK5HWMp GWysgBX9xC31TRQSjqy3kVbq+hr8HTCwdQI373KQqVgdJ+tvv9KiZ4BKNTX/NH+JCr75+rTrety HZjYLIEwdhVHIUSX8MysgLQH1KcMjPggTMeQoZgxpDzMcaUc8Nt2V+o7PyeOJCmx1MPBQJG7+Vl zoQGETaGgP7RWWzsWasKZXQdyUwlwbdlcD/mJtAx80UIduzMW/z2YYMKR6BNYO4w43xjTN8bRSu QIQMNrgovYFSQozpl65x0ugXtaHPMJcxMN0OqXcazVZysVm67Sd4MqtLM8s38a1CzjZHpVpJ1FD H/l0sS37JzIkYoZbAqDbbFVrKa5Paz2BDPJ/KP2ZX/yG8R8JWoNn+gArLr3DvM22o0/veHPT9RA Yk+HJp5mncc87kzuj7MiHmTDIZLSX9ClbrkQ6/NM2Ai9o30UdeUQOEyEmWdG4jJFt2JNdeIquib mw5JqY6OXrxQoaw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/soc/qcom/ocmem.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c index 6b6dd80cbc0f..ff8df7d75d6b 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -186,23 +186,20 @@ static void update_range(struct ocmem *ocmem, struct ocmem_buf *buf, struct ocmem *of_get_ocmem(struct device *dev) { struct platform_device *pdev; - struct device_node *devnode; struct ocmem *ocmem; - devnode = of_parse_phandle(dev->of_node, "sram", 0); + struct device_node *devnode __free(device_node) = of_parse_phandle(dev->of_node, + "sram", 0); if (!devnode || !devnode->parent) { dev_err(dev, "Cannot look up sram phandle\n"); - of_node_put(devnode); return ERR_PTR(-ENODEV); } pdev = of_find_device_by_node(devnode->parent); if (!pdev) { dev_err(dev, "Cannot find device node %s\n", devnode->name); - of_node_put(devnode); return ERR_PTR(-EPROBE_DEFER); } - of_node_put(devnode); ocmem = platform_get_drvdata(pdev); if (!ocmem) { From patchwork Tue Aug 13 13:09:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 818890 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E40E519D8B2 for ; Tue, 13 Aug 2024 13:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554618; cv=none; b=lVzG0Tgg4kRycorUemvZVsBBI7N07Xn7muHYErthT2tHcq7e03uqOwMCN9fuhovJBc7Tjw+ILTP4tV03PcHnWETyaagLUUf9112DEU0TyK80rpfCu81Mh4BBFBYzLgw6453t45zc+uG4AnaLCgy4gJhPd27zqe1x7VrqFxnEsFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554618; c=relaxed/simple; bh=IxBzL8jZcrNuPWO/7D8XwVLbEykT+21gC+FbHu5yEzg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Dzw1OJsaqy11+JalFtgi9Ed+bjQJrlyRy6Iil47N5jY+XkbEvKD4tlCbcr6I2UH6knm2QBuW5s4JSLku/zRMvzHnRockztUvnkcDMa6jYwIwbbH763mNYxDHBelnQKI9q1cYESENHlFgGMJT1O+CQ36l2SEz5d0HyPYF0L9SfGY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=V11m+ZDP; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="V11m+ZDP" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-369cb9f086aso3248570f8f.0 for ; Tue, 13 Aug 2024 06:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723554615; x=1724159415; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rJOIZffdYgY6uiS66ZwE+qixLpFdnbV3QcaMFwjqIS8=; b=V11m+ZDPN7WTGjA8gG3UmTCLDbqIIvEszcP9tfaPTsCZKx5DgUyr9ZUdwsNkEzXt57 Eley1DKdx98Lf8v8gj4kG/ZYWhYiOeaZD0X8gQ/Y7vC2CX/zTzL1xNNDyNF/uR+D/nV6 MoCdkSIw4ETnb35x53/0Xs99grRlbfLX1RXGZyIOuOfrWM9DV0UaVuII5cMSXWgT7qX3 aQ2yeHULSJ006w3zi4kl/X+u40RP+CzPHcVaYmREnGjPrvMVFc9617HW0yYQMTRMF0vc VgE+DAXS6kIKILqraskwmSyYJgXhxLzHkS2jOhmPIuvMidmRzhv1WrDMsf/Um6Sne+Uu IqIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723554615; x=1724159415; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rJOIZffdYgY6uiS66ZwE+qixLpFdnbV3QcaMFwjqIS8=; b=Q0VqAigaCh1V5eCY3kKvMBU968eHtZPp+EEjZNmdtamhsZ1/4EFvXc/b3I1ftq26DM NxDbbXPEuQnvTwCvMJQ6K05smCu60n/FgmNVcvTv4tLwaD5aYo1PhfAz2vZcrHd5/N58 opse+K/LQyahIyScnWm60nQYgTvpE0BwjzmWq+I3v7bnZPTIcvbhldE7OM2TcS9ITvf3 dNLibG221NYYL758oiTanw05gyD1B13hcYd7RTTe6WSBwXG0X5yFq32pDYjYoQ72NJAo FnXADdlt5UoTZPLa5oKnGPwnZ5R4fa/YYkJGKwrP2vE8QFIqBbN9r743LWulHuMutrGW QMGg== X-Forwarded-Encrypted: i=1; AJvYcCXoo8Euk2DwqIPrFU+Z8cBh1QSXjpMJCrjDMA+bKqANjm4Y0MDyeBAdo+wjsUrI1/hEM0DePXtRVrWnTdBJFBWxde39wNFjzrPU6lZ5CA== X-Gm-Message-State: AOJu0Yzc31B/1jybqtEMY9jhqHWcZPCyfeeXNxXq9lnKmbkKIzMyosaC yvQ3MjvvLyMirv4XwXiNnOP0+48gu/DEsvvipZhI1grTQ/iZxm7GVootMY4ex0llPtkGyGsNRb+ 6 X-Google-Smtp-Source: AGHT+IH2fWoDkGNXR0eRrjdb6m7GxMgF+j9Va9DvtxfYZzZLGqKP3dmGXHQVk6zw5owlp+AcpM80rQ== X-Received: by 2002:a5d:5f55:0:b0:35f:cd7:5ba1 with SMTP id ffacd0b85a97d-3716cd45ff1mr2848538f8f.60.1723554615211; Tue, 13 Aug 2024 06:10:15 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4c938280sm10305003f8f.36.2024.08.13.06.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:10:14 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 13 Aug 2024 15:09:51 +0200 Subject: [PATCH 5/6] soc: qcom: pbs: use scoped device node handling to simplify error paths Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240813-b4-cleanup-h-of-node-put-other-v1-5-cfb67323a95c@linaro.org> References: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> In-Reply-To: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> To: Srinivas Kandagatla , Banajit Goswami , Bjorn Andersson , Konrad Dybcio Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2160; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=IxBzL8jZcrNuPWO/7D8XwVLbEykT+21gC+FbHu5yEzg=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmu1sjtqc3LW0OQNAOtQMO9+aLWWp94JHd3wNgK r/V4thgZHyJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZrtbIwAKCRDBN2bmhouD 1xhVD/0RgrZURCzpXb3YXvnPk6hKrlLP06DLbvCh62dHZC7woXTSyVi7a8IL4ASirn+Sb2K3X9q d3xyu3wLmnNLwCMt8/oAbK8OCelqtGjohE/HWKV+4w2dpHLI+BfdBlv9dXG07iWeDFGImCtYJaf FHZQD21L1VuhPv53cz2rAnF0t1rsVh8Py6TNfOTQ4Xe3Ko9WCYtqS68W5hzuNHs+bnFrKgARQYa xzPw8NoDX2Z7iXZSGQ4iEhM9W/HLPAeAlGPNnaqLkucx+mp/uNWmCIouUYtZJdwn8+kjSvH+/iW xSEn7wI2yxrAj9PeGCxbz50rnvkuj5xcnRKF30sJSYhm+O9VVq8b4CffXZH6D2FFjYkJfLLxtXX hELXzZnEaihOvGuY6FkBLWg0bpVeec/vgG93UtmE1/yArs+kyqtaPAkrcYk6TnJDZswr/Nry7jN QVZ0sMCg+uP/BVPmokjBVl3wvRKuF1qJ8q1hsKs6yYPKI04ow/NnPPEMBgFqEU2NZWd0MNlu2vX 8l1HxlV4MpRquSCvz5L7/VG35i1kIOimX8/tLkip0PAlD/pOBGZPtargXrpTgyhy2l9KcCqU+hG tF9B7iEHl8akSUQtX2rairPy+sOwumSqE+jvjj8y11gFz27qtrNI7vLXop7r2tNleIoDP1IgACA wfFtE7W6uRM0Oqw== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/soc/qcom/qcom-pbs.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/soc/qcom/qcom-pbs.c b/drivers/soc/qcom/qcom-pbs.c index 6af49b5060e5..77a70d3d0d0b 100644 --- a/drivers/soc/qcom/qcom-pbs.c +++ b/drivers/soc/qcom/qcom-pbs.c @@ -3,6 +3,7 @@ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. */ +#include #include #include #include @@ -148,11 +149,11 @@ EXPORT_SYMBOL_GPL(qcom_pbs_trigger_event); */ struct pbs_dev *get_pbs_client_device(struct device *dev) { - struct device_node *pbs_dev_node; struct platform_device *pdev; struct pbs_dev *pbs; - pbs_dev_node = of_parse_phandle(dev->of_node, "qcom,pbs", 0); + struct device_node *pbs_dev_node __free(device_node) = of_parse_phandle(dev->of_node, + "qcom,pbs", 0); if (!pbs_dev_node) { dev_err(dev, "Missing qcom,pbs property\n"); return ERR_PTR(-ENODEV); @@ -161,28 +162,23 @@ struct pbs_dev *get_pbs_client_device(struct device *dev) pdev = of_find_device_by_node(pbs_dev_node); if (!pdev) { dev_err(dev, "Unable to find PBS dev_node\n"); - pbs = ERR_PTR(-EPROBE_DEFER); - goto out; + return ERR_PTR(-EPROBE_DEFER); } pbs = platform_get_drvdata(pdev); if (!pbs) { dev_err(dev, "Cannot get pbs instance from %s\n", dev_name(&pdev->dev)); platform_device_put(pdev); - pbs = ERR_PTR(-EPROBE_DEFER); - goto out; + return ERR_PTR(-EPROBE_DEFER); } pbs->link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER); if (!pbs->link) { dev_err(&pdev->dev, "Failed to create device link to consumer %s\n", dev_name(dev)); platform_device_put(pdev); - pbs = ERR_PTR(-EINVAL); - goto out; + return ERR_PTR(-EINVAL); } -out: - of_node_put(pbs_dev_node); return pbs; } EXPORT_SYMBOL_GPL(get_pbs_client_device); From patchwork Tue Aug 13 13:09:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 819530 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 681DC19DF47 for ; Tue, 13 Aug 2024 13:10:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554621; cv=none; b=I6j4AiGaN9VTSSdaqoVBSlpn+qLodGST2uzf6uvCFke+QIynnqgH3agWvwRr2IChP5cA3UdKx9m26qvnJZsr6bm/jZ4nG/i4T4A3OZZcdZPGfrFgdEFrHnltTOFjNDzQOofSeYOuTRWa5MKS5C4IiRDKUNNNrfedklukPZTtqzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723554621; c=relaxed/simple; bh=2cwE07vpiCyGBrhyTLV34EZJb7Hk/Mu8zBy8VUuQNto=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bi1E2aDyFdUR3/r83FYQmtrIHgFNNkRXACZi1CiOmLo6HNxoQHGF8HsjkoQuINf12CfBIIJaCKHTnV3sP4xiztJOV5F/+KQkyTFWNa0nAbol9CQZv/Db+RLJGwholG3zWP0dJOguWmzheY/yanYzYwoavKdveP9XS4A4d06AI4A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=xoLyesT0; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xoLyesT0" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3686b554cfcso2826186f8f.1 for ; Tue, 13 Aug 2024 06:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723554618; x=1724159418; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mP8c2gbWyRGgea+bz+7uGbaKYyoVwEycZmklOCGi8GE=; b=xoLyesT0Sz/+NSSubmN9u+b5ybKkEz1lKXc0JYxDijE3uqMmzxAus2VZ9icMNGMXxZ fPoTC4uFFfE3+BpO+HxrX934QKHsjFtEy/PNFXevcPspqUH1bn9h0MlBqdf3/wL9hRgc RALbS/bYNM3KqN3DM/TVGsRmFd0EwAay0B0Q5Ft3PZWeSW9BjZmg9kt0ZLX7grfu1pdG /g6RPkPKYl5HcaEWPtqvhcNtqB7MRKICBDwoheyAkdTJ70H39PK7WBVq+7ZNgeK/73HS rWk9Mhelz8adRd8jqERSNBsct76vjFDqTppgIl40reR6htDoGAdMp9byQtIdsrSxo4Gy JFpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723554618; x=1724159418; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mP8c2gbWyRGgea+bz+7uGbaKYyoVwEycZmklOCGi8GE=; b=ennZQyjyK8qkrN/oykGZJk9tlvOq3nRqUdMn/PB73wt1FE75yavRyw24YrdiPKwPHn Z98O2aTlVvz4O+FpQNxs3dgIWxp/gdIYevIo9KBP/KIHO7gSna6vjlxE6excWbJonEiS QDGeg0kPTcdnZp/VhjSDFLbxFUtQJ998/9pE+oVAJckizTy296oKPkJil9VwCb4bj1Cd oVEVX7UIuIVHgfuOPmcmQOzHmQ/o0KfoNpSv6Xgaivr/zMUztTVicR7S0Ywk0XRBXIIq w8eNHJxZh0k9nd2DJRmtBPJPdfaELi+wjb8QDLhgEbgqf4BcmM1PO0oU/CQwvMAa/7yP 9rJQ== X-Forwarded-Encrypted: i=1; AJvYcCWpOpcEQNwcSyMvdanRfMJFodHaEatYN8uNpILbRxS6UTyw9BhsQDqQUtb6MuiJ35hXeJy5v+/SeRBryMxMib0u+NzIxA+HuGbwZEIvuw== X-Gm-Message-State: AOJu0YxCALVwa+XV0EPoTfAbGqYptk3tAUd4UeBXMHPgwClrIeyDeBJE 9tNi8B7FNJW6Zyv4EHJFQ5+rnirudzdMair4eyq6twRkHMeTwXhvBOsGLPV5pvw= X-Google-Smtp-Source: AGHT+IEDchtCCXZEFTjTv7KCKp+KTGrJNg4Wo5BxMZL+yOQsb/AR6j4g5GGlBRSIedjp6ch6nbqYkQ== X-Received: by 2002:a5d:4481:0:b0:367:96b5:784e with SMTP id ffacd0b85a97d-3716cd28208mr1973169f8f.50.1723554617874; Tue, 13 Aug 2024 06:10:17 -0700 (PDT) Received: from [127.0.1.1] ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4c938280sm10305003f8f.36.2024.08.13.06.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:10:15 -0700 (PDT) From: Krzysztof Kozlowski Date: Tue, 13 Aug 2024 15:09:52 +0200 Subject: [PATCH 6/6] soc: qcom: smp2p: use scoped device node handling to simplify error paths Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240813-b4-cleanup-h-of-node-put-other-v1-6-cfb67323a95c@linaro.org> References: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> In-Reply-To: <20240813-b4-cleanup-h-of-node-put-other-v1-0-cfb67323a95c@linaro.org> To: Srinivas Kandagatla , Banajit Goswami , Bjorn Andersson , Konrad Dybcio Cc: alsa-devel@alsa-project.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1946; i=krzysztof.kozlowski@linaro.org; h=from:subject:message-id; bh=2cwE07vpiCyGBrhyTLV34EZJb7Hk/Mu8zBy8VUuQNto=; b=owEBbQKS/ZANAwAKAcE3ZuaGi4PXAcsmYgBmu1sjJN14aYmlpr8rTr9yYtjfVVS+zWUS2l146 f7fNMYMCtCJAjMEAAEKAB0WIQTd0mIoPREbIztuuKjBN2bmhouD1wUCZrtbIwAKCRDBN2bmhouD 1xmRD/9h/P0Het6Jm2rGA3UM3LAszAgU3PyV5T6E96tiL7xRF6IrhT+P6GS1+HrZeLHZt/7/3v2 xvbX4iYvn7yHnGp//K4u+6YB3isGbI0dSbliRFs8bqdp8MndfYQoMw77n9rZJbSBqLDI8NLKshS wUDaHY5WFF894y/XXeTDM/PRA5cD6BlzevUcWPmr8gDtvUH8+LgocW+2P2UwnCwmX2DgwN3ZeQM WqLLEiUQTen+QI37hpUg6TvRYCRMLFkr/VMs3/kbHRYir/fBuolFVZFawgeX6gP7BLNVmUQxEst ZfqX7RPXVbf3zxG6ZNz74mbX9zbRSw0QoJczdjKiHMGOipCWmR778oHi8igpEKH4eTsQdRJhFnY zK15u0Qs8HFOm8ALMDmYrhsUOQyfuwdBcpI23XBimnNl/yZPViJZREmTEZkfe390bmIpc7mTTgo nzFuLKquUdYF3T6nDfVXN8btg3tXea42nBTjwWdVR5l8wXJSJWZiMZf/tkl53OxOE0jRJtLehRo 8lVeIsD4Fcs0OwUKubSHxP8JxytWepvza4Ay3hdomgSPOilOyZfspn4RQikAl02pnm393jTf9M5 MSeWXlH4VsVFvDiWocSaYUlIMxbToTvHCjMFE1B70QBhw6ry724w2jy33jv+7Mb55dEb/lL0s29 2YG/JDwEhwT04cA== X-Developer-Key: i=krzysztof.kozlowski@linaro.org; a=openpgp; fpr=9BD07E0E0C51F8D59677B7541B93437D3B41629B Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/soc/qcom/smp2p.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c index 4aa61b0f11ad..cefcbd61c628 100644 --- a/drivers/soc/qcom/smp2p.c +++ b/drivers/soc/qcom/smp2p.c @@ -539,7 +539,6 @@ static int smp2p_parse_ipc(struct qcom_smp2p *smp2p) static int qcom_smp2p_probe(struct platform_device *pdev) { struct smp2p_entry *entry; - struct device_node *node; struct qcom_smp2p *smp2p; const char *key; int irq; @@ -593,11 +592,10 @@ static int qcom_smp2p_probe(struct platform_device *pdev) if (ret < 0) goto release_mbox; - for_each_available_child_of_node(pdev->dev.of_node, node) { + for_each_available_child_of_node_scoped(pdev->dev.of_node, node) { entry = devm_kzalloc(&pdev->dev, sizeof(*entry), GFP_KERNEL); if (!entry) { ret = -ENOMEM; - of_node_put(node); goto unwind_interfaces; } @@ -605,25 +603,19 @@ static int qcom_smp2p_probe(struct platform_device *pdev) spin_lock_init(&entry->lock); ret = of_property_read_string(node, "qcom,entry-name", &entry->name); - if (ret < 0) { - of_node_put(node); + if (ret < 0) goto unwind_interfaces; - } if (of_property_read_bool(node, "interrupt-controller")) { ret = qcom_smp2p_inbound_entry(smp2p, entry, node); - if (ret < 0) { - of_node_put(node); + if (ret < 0) goto unwind_interfaces; - } list_add(&entry->node, &smp2p->inbound); } else { ret = qcom_smp2p_outbound_entry(smp2p, entry, node); - if (ret < 0) { - of_node_put(node); + if (ret < 0) goto unwind_interfaces; - } list_add(&entry->node, &smp2p->outbound); }