Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp253047lqn; Thu, 11 Apr 2024 23:25:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX2pq7JUwBJxWGhC+lLXpWlWtHF5KhvUWKhMHWehGQLOWHq7lh6kLUUD20pD+E+7cUaKXtDpdbZrPb935XcPcGt8W9+vtlMT91mr29DLA== X-Google-Smtp-Source: AGHT+IF0NLxPRpJqAVg2AZeM8ObHQRIOlXg+xJYye0i4zHVNuzo2PM0t13Csspevr9zIB2XZCC3p X-Received: by 2002:a05:6a00:1307:b0:6ea:be74:a228 with SMTP id j7-20020a056a00130700b006eabe74a228mr1798006pfu.28.1712903151518; Thu, 11 Apr 2024 23:25:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712903151; cv=pass; d=google.com; s=arc-20160816; b=S1OF7R6cQrjdhFQx74lYVXRxr3NbhpIOMkCW2VrLv8n/+qgsppC42xYjp88WblwBfX Vz5E5b2QI2LfsaqE7uyZ0u1oZvM72cPboV9/WawDoydtVQwyXHE6X3JAuqiLrk3C2jTJ lFxHW96agPrrqOQu1ETb7kXnjaKSdVIT47wYHfBCJYtP26zXEUEBrbt6kA/aMg9hDGxj sxo+07euPTv8VPCLEK4PqTWSXWiO+LWnDULLQTb1EZEj4lKh8ixVkIFGFbFo01S2qS4W 0E5IamAbqaSQNytTVPvaVkxq3ixhAxzdmtuE9pOrWzK0TTZDSgCi8Nqg5SaOtz6FEDwY /3sA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:message-id:in-reply-to:subject:cc:to:from :date:dkim-signature; bh=I5FV9y1cxUtXTeIw4zxGn7mwJ5/NnPbk/Fu5KJrJVaQ=; fh=A3i0EsL+k6PWxHZCC9C7Ph4GJ+8jEacWDzLwMgsm6wg=; b=puy7wHyB1RjTuQXF5Xthvd2dwFySbp6Hy2edVOcp5ePBnUp0SJkoJaf7bJWit2gdPU bseZGgedIgrwZdSE2j6Sr51MxlOGgSQaFnuwedNmMkUNTLO1Ge4OBbAWQe1ZWnQDQJ24 XAzCKiQItg+ItA8WwquB3hQgY+xSwOVFe27jrbB1mGuEh9e2qmJ6Ajue5FPOernLR1lH gctXtETXsmyTjQ1BEo0Z2a0FlOEwv6g/4dQgHWBISZpDhiXBjem6c+5a9dEAmN2GAjnm ym9dzcoBamFHCzp8Z9FdLgn23D+iCm7A3XwrhRBfAYj9LKhutK0/ChG1B1pVR19rsQk/ W5Fg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=lcjPlO4Q; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-142029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142029-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y14-20020aa79e0e000000b006e8f71c6382si2756763pfq.361.2024.04.11.23.25.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 23:25:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=lcjPlO4Q; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-142029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142029-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 2BBBFB24F24 for ; Fri, 12 Apr 2024 06:22:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D5BB383B5; Fri, 12 Apr 2024 06:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="lcjPlO4Q" Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) (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 6E330E542; Fri, 12 Apr 2024 06:22:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.134.164.83 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712902966; cv=none; b=FfiJT/5Fy3/jYFIhKlLwc1v6G+4TWGxfxeXXkt1WJsMwkx+UGXpbSRgZIwYEghFOJwAXB/TajF97x173ia5iZMsxfSTGi92C18iTp1Wwd1dhyFW4TSBbib1WSKPN9aM2oWwf6o7OJjQauSmpp0oxOWCKgJX53hhCXuUT1ImSFU0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712902966; c=relaxed/simple; bh=I9aBK5dbrhcLKKL/MjbcYuCu6MZvLINSTsHK4HqiwmY=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=dNWXPnZ565Mawl3nX738qGtQFFXlG61od5gqDOU6CPYXNfKIpHbY+kRTETREBLfwG1SVCjELtZRfS/07JrkTR201EDOhk/Dy82QWgbmZFDb5rcC68srJP55xCjn0bJVQ1AwQ7MzpREZFhNijSBRPO2GfLRlpAGHTpS1J8/K68Jg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr; spf=pass smtp.mailfrom=inria.fr; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b=lcjPlO4Q; arc=none smtp.client-ip=192.134.164.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=I5FV9y1cxUtXTeIw4zxGn7mwJ5/NnPbk/Fu5KJrJVaQ=; b=lcjPlO4QuLiofl/z2VrHVX8/JVna8Xe2yfTHpz/M2jvRem9Gw/iW1JyT DoXDc45a4ozCnM5br6N3g/NSN4MVWmA22eo4zXtHI1OAziqtWpy5m9+yY r9ksScekmVXrDIFKg7Msv1blvJphv8bHCv681m6kli3BkLnW+IZ2xPZsg k=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.07,195,1708383600"; d="scan'208";a="161185143" Received: from 231.85.89.92.rev.sfr.net (HELO hadrien) ([92.89.85.231]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 08:21:31 +0200 Date: Fri, 12 Apr 2024 08:21:30 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Greg KH , Rob Herring , Saravana Kannan , devicetree@vger.kernel.org cc: Roman Storozhenko , jirislaby@kernel.org, skhan@linuxfoundation.org, javier.carrasco.cruz@gmail.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH] sysrq: Auto release device node using __free attribute In-Reply-To: <2024041211-statistic-reformist-bf70@gregkh> Message-ID: References: <20240411180256.61001-1-romeusmeister@gmail.com> <2024041111-tummy-boil-a6aa@gregkh> <2024041211-statistic-reformist-bf70@gregkh> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) 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=US-ASCII [Adding the OF maintainers and device tree mailing list] > > Maybe it would be nice to get rid of of_node_puts in the general case? > > That's a call for the of maintainer to make, and then if so, to do it > across the whole tree, right? Sure. Rob and Saravana, what do you think about the following: * Is it ok to use __free(device_tree) directly in a declaration, or is there some macro that should be used instead? * If is ok to use __free(device_tree) even in simple cases where a variable is just declared at the start of the scope and freed at the end, and there is no internediate error handling code? Please see for example: https://lore.kernel.org/lkml/alpine.DEB.2.22.394.2401291455430.8649@hadrien/ But I don't think we can do the whole thing at once, in one patch. There are a lot of things that need to be checked, and it don't break anything to do them one at a time. > > > Even though this one is not very annoying, there are some other functions > > where there are many of_node_puts, and convoluted error handling code to > > incorporate them on both the success and failure path. So maybe it would > > be better to avoid the situation of having them sometimes and not having > > them other times? But this is an opinion, and if the general consensus is > > to only get rid of the cases that currently add complexity, then that is > > possible too. > > Let's keep things simple until it has to be complex please. I meant that the current code is complex and error prone, and using __free eliminates code that is ugly and has led to memory leaks in the past (and a lot of effort to find and fix them in the past). Even if some instances don't have that property, they may become more complex in the future, if some error condition is detected. julia