Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3304442lqo; Tue, 21 May 2024 12:43:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVniYGWmWQTCpxhzVLuWzBHruyIEELAZhst0HOTGQ4sc7A9gBUXqKeYdEgdieBeObM/83JR3QrpC+0AzMlHSeheZD7zXwd/Vbti7q9+vA== X-Google-Smtp-Source: AGHT+IHxj6qKZ0n4Tm3WiPtAHIjCrotCK+qwlpatPLTsio5mi/30RWoGtnouCC0Ciy2CNOYNdeYq X-Received: by 2002:a05:6358:8a8:b0:184:fdb:6cc8 with SMTP id e5c5f4694b2df-193bcebc8e0mr2821670255d.24.1716320626113; Tue, 21 May 2024 12:43:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716320626; cv=pass; d=google.com; s=arc-20160816; b=WMU9mJHlWLaZZ5nYsC1B+uCNQdaCnY92wtRtlgJ4p9JfS4xuUiybHvRkOgHeIyEfsX E+EGTdWEv9Q73x7YgUoYrYWqvnRZtJXR8a249NEQpIzrBm5pRsMTGtQBQcigk+PQwmH5 nSGEEVYMLPWdObSaA8lcRPdbSZ1K+2bYG/TyVT68y5AS2vTl7ZcGtv37SxVmtAe4vhn+ NmHUpJT+ZKxJ0G9CqxrVWOT/uHXHoeBiOZyv6oeldpceS9QdGRB8/JDu05q0LXHNXnhw tdLXRhBYL5xnICzoRZCFzqr6XpoyAJkCQlnK02AjMDiqlnlab/Spce6uRShlU5syFK4E 7kKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cqoHDuBiUbHtYw/508huYL/EIPtHAho3rzh0DMUdW4k=; fh=RwEKM0NF5x/fxLBT7wwRSCicc/A3ZrHKw9kNSH3bHvQ=; b=IbIB7d7SyIZ8NZk6QeaaQzABzajUk6p0K3KiRdmngB41sDHNsJNKmqF5+UosA/vz5Y ouVS2vS5oe0218W/dHtx1loG2f17mrmZ2iYIuluzuq48tcTGFq4wg7xcZ197i5OGOQ2B wgiOChw2Jh7sjuvI4jEuJ13sjSYclFGKnpqEa6AZUqsTm8kcVc55RVjiqnHkSwjZjo/j 6aX7DiOqQP6FiEo6wzZX2TCsEe2rHpQs5XTBlsIrSHo94ABlGD1hZNSVVjyFGonYNQ5U wXBZVztcudRsdpCs7FXkZe1WgYsms6Z5aznelGfLw9dvqpvshv5FFppsIguo1PhsVxBR iOVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MlqlcRnJ; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-185390-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f4d2b1bb4fsi22626298b3a.278.2024.05.21.12.43.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 12:43:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185390-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MlqlcRnJ; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-185390-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AF5DD282340 for ; Tue, 21 May 2024 19:43:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BC931494B9; Tue, 21 May 2024 19:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="MlqlcRnJ" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2160148301; Tue, 21 May 2024 19:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716320616; cv=none; b=Vr6TmG6OXD5sESUMMhuzwGn8yydIQAU6mvnAR+a8eNedYd3GdHrYFpwK8jAR4IGeK/5F+8TWzLXr0zm2Fped5aGC78pvebRrE998BkikeqgQKSkcBbheO9SnHpZfRkqIX1W3zRREa6i7trVY/NXjNnB9Cm6x+9COXodguniMd9E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716320616; c=relaxed/simple; bh=3HxYsuE4vwht7mgql4QlXI/YmOzZn0ERD38uVvGnylQ=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ESKb53X8nZgHLRzcoYpEIwVHqIcIEj2Jym9Uyw9wH4mImZouwaEcabU9ORIy8WXIMa0SOtB1s/M/pYMa9pMR1w6jbAE7nW5GMXVUYpTPsGyojLu4w4XcGXmeDL2AzOlslSePiEDGMvG3pLynYRBPSMteqPfwn5t07tUBlgWVsn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=MlqlcRnJ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44LDx5tV012339; Tue, 21 May 2024 19:43:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s= qcppdkim1; bh=cqoHDuBiUbHtYw/508huYL/EIPtHAho3rzh0DMUdW4k=; b=Ml qlcRnJBx3RY8asyCvl8tw2mf1bUkBJAPv2Ge8J0Tfjird/l4Yg4sofkYXUry9OW3 K0XNrL5pXBxy6DjypnuINVJ6zx7UU9PNzXbzVDWZmr9VhgopDRHF/sMK/cYXQohg sxGe0nfO4hymr4KHjblmZSRKCIDNcx8zQo4+aSVQQZyGRAUD78j2uvd6NKf/ulBr nnKVpz1+wUnVPwMEb4ix4Vh7kiuVaU7qRhBK+MfVaUGkr/4vg/XgUPFyKrhkriHh Vvn/c+jgA1Eq+vFaXWPHqOlQCc5Xq10jGgDZxo2tHEHe+JAkvBKFXSto28jG5oQ7 uWsJrWoJxgyCLC19UWtA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y6psay0hv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 19:43:26 +0000 (GMT) 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 44LJhOYN030881 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 May 2024 19:43:24 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.1544.9; Tue, 21 May 2024 12:43:23 -0700 Date: Tue, 21 May 2024 12:43:22 -0700 From: Bjorn Andersson To: prabhav kumar CC: , , , , , , Subject: Re: [PATCH next] drivers: soc: qcom: Auto cleanup using __free(device_node) Message-ID: References: <20240407072330.229076-1-pvkumar5749404@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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-GUID: BI_p40hjresZpelIRK7LbPciGlFMhhMa X-Proofpoint-ORIG-GUID: BI_p40hjresZpelIRK7LbPciGlFMhhMa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_12,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 impostorscore=0 spamscore=0 clxscore=1015 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405210148 On Wed, May 22, 2024 at 01:01:22AM +0530, prabhav kumar wrote: > On Wed, May 22, 2024 at 12:50 AM Bjorn Andersson > wrote: > > > > On Sun, Apr 07, 2024 at 12:53:30PM +0530, Prabhav Kumar Vaish wrote: > > > Use automated cleanup to replace of_node_put() in qcom_smem_resolve_mem(). > > > > > > > I don't find this easier to read or maintain. > Should I change it , explaining the change ?? > > > > Also, your subject prefix does not match other changes to this driver. > The patch is to add a __free function attribute to np pointer > initialization ensuring > the pointers are freed as soon as they go out of scope, thus removing > the work to > manually free them using of_node_put. Yes, that is what the __free() attribute does, but I don't find it easier to read and unless I'm missing something you're not fixing an actual issue here? Regards, Bjorn > > > > Regards, > > Bjorn > > > > > Signed-off-by: Prabhav Kumar Vaish > > > --- > > > drivers/soc/qcom/smem.c | 4 +--- > > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c > > > index 7191fa0c087f..ad1cf8dcc6ec 100644 > > > --- a/drivers/soc/qcom/smem.c > > > +++ b/drivers/soc/qcom/smem.c > > > @@ -1032,18 +1032,16 @@ static int qcom_smem_resolve_mem(struct qcom_smem *smem, const char *name, > > > struct smem_region *region) > > > { > > > struct device *dev = smem->dev; > > > - struct device_node *np; > > > struct resource r; > > > int ret; > > > + struct device_node *np __free(device_node) = of_parse_phandle(dev->of_node, name, 0); > > > > > > - np = of_parse_phandle(dev->of_node, name, 0); > > > if (!np) { > > > dev_err(dev, "No %s specified\n", name); > > > return -EINVAL; > > > } > > > > > > ret = of_address_to_resource(np, 0, &r); > > > - of_node_put(np); > > > if (ret) > > > return ret; > > > > > > -- > > > 2.34.1 > > >