Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp124187lqj; Thu, 11 Apr 2024 11:37:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW7A68xT+g5ajd7tAVGxJ2J43LuJNOinypishbSKoa77H5x9sOSI7ldsCadwowyexc9d6Me5jYKvWLQnsyXj5ji8w6rOC1LLuSWo9TkbQ== X-Google-Smtp-Source: AGHT+IElOu/bXB5hM9KXAIQqxQHPhYdzlrPRaXApql6PjQ/M9p7cdpj6761oR3AyeAhFQUZYuan8 X-Received: by 2002:ac8:1285:0:b0:436:84b1:126 with SMTP id y5-20020ac81285000000b0043684b10126mr283248qti.49.1712860660001; Thu, 11 Apr 2024 11:37:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712860659; cv=pass; d=google.com; s=arc-20160816; b=OfBeuRJAqsfPsV/5F2IswoA7ifhGF29S586eoTkOQULAfGGDHrgB34Za9/19/gTg3o k29m2mmwKzMG7uEYZ1enXwXaJcGLXBbJtnP8ylfrM9hBMbv/YbemyGB8+Iajl5YVe8T6 RZGvb+Madr8qnK32BMPKEgKJopzcNtlmtDC0f1wb4iPfxStdCn8J0vEwKYdSsX15isbP bTF/lOe1ZeRA1jot3f9aSKYlJ2lCoz/ldyrHySeMC4GsY/9OMLPxMOavv5+TtgYtVp1G 3yo/G6BiGJ2iCRhmyM3hIv/+XyGlo14/jELzIRUnC6psJ5zrHeQIf2cntlhgc0rIiPh1 He9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pIM2kvjcHuIQu5LlQ7rG5bVdES7+LTPqcn0kLGH0Xuo=; fh=d2uLX7C8aVXfGf+f034rZJIVKZHDtC7m2ff1sxC8oPI=; b=C61PaNIZYsxxWfgwq6a63Z3BuP6x4/37Tz/U8p0ojAtWilhC5Be/o19qaiOuP1SiE4 7FiBiQFAu2ad9WNcUE6OOWxKW4eJzx6U+JzuRiqq4LORmNrdypy4lF9aURVlfv7EKxkm uzScL0ob4czmoM1+bddnaXSqpKe+jQJnRzICX4opi1rdSFN5lPi28HLX6GwT1X+MLR0M /iQMjssvHlay9clxdNrK80jvT2QSw4r7gMeNI85Kd0ECch/8GOg2+xoumuTWoUDzofOK z3FxM7PgJkUJq18xOcVMpvuyitCO96JDhp+I63LkmXkiTKf5fRCVnXILsH/PonfnTsWX vlAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NncTN4tR; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-141456-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141456-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w19-20020a05622a135300b0043686aac78fsi94094qtk.42.2024.04.11.11.37.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 11:37:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141456-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NncTN4tR; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-141456-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141456-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CA8F31C2471D for ; Thu, 11 Apr 2024 18:37:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B1042139563; Thu, 11 Apr 2024 18:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NncTN4tR" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CDBF84F20A; Thu, 11 Apr 2024 18:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712859006; cv=none; b=H8VD1G1GpxQCN6mpXw+DsKPrA6hCgzgWskpMsu1Vl+pNgpnBNw8zfHjdVbwvQ3orfg9KfcSGZFZUUbPZVVK9F2aA0/yoIltAV8yAc3bS9fAKdyDS17FwuXR+w2bqyQe9bI5XUfGKKZ4s+G4XQRUOGiuJiks8Bn/00Nz1gWtkdOA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712859006; c=relaxed/simple; bh=ZGBgyafpmKoKHUJVnGr1ydBDerMlQpXQky8psG7f2Z8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UyeGWJwGlFYRS9AkNcEHPqUw9FM3v1MYPEBtnBXQt0jcoVFAIvYqbkNlqyUJ1jd8G9Ppdau92V4uSiwTXZNTfyG8peVQDsmZYJbFZJjFMbpl916OlQ7xP92YtLd9n9hDNNOkvJibRua5Xqlfkes5WIzeZ5fUqB2hHYznJuY28u0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NncTN4tR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E288EC072AA; Thu, 11 Apr 2024 18:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712859006; bh=ZGBgyafpmKoKHUJVnGr1ydBDerMlQpXQky8psG7f2Z8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NncTN4tRRsKOdV9NtIGff+qoDc46Z4ObDpdAgzuruKoHADJX5L7lRNQrV8yzYPfjY 0C85GAbh2ZxuNe77XxZ0YHHxV4Q42syNW8mUeV0SnTO5EZ1yiawD6eSxWSTyEIo4ra saisB5m3XEdmKzSIcY4DFtN4CUGAZeHBtSpH/MbQ= Date: Thu, 11 Apr 2024 20:10:03 +0200 From: Greg KH To: Roman Storozhenko Cc: jirislaby@kernel.org, Julia.Lawall@inria.fr, 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 Message-ID: <2024041146-exciting-predefine-05bb@gregkh> References: <20240411180256.61001-1-romeusmeister@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=us-ascii Content-Disposition: inline In-Reply-To: <20240411180256.61001-1-romeusmeister@gmail.com> On Thu, Apr 11, 2024 at 08:02:56PM +0200, Roman Storozhenko wrote: > Add a cleanup function attribute '__free(device_node)' to the device node > pointer initialization statement and remove the pairing cleanup function > call of 'of_node_put' at the end of the function. > The '_free()' attrubute is introduced by scope-based resource management > in-kernel framework implemented in 'cleanup.h'. A pointer marked with > '__free()' attribute makes a compiler insert a cleanup function call > to the places where the pointer goes out of the scope. This feature > allows to get rid of manual cleanup function calls. > > Suggested-by: Julia.Lawall > Signed-off-by: Roman Storozhenko > --- > This patch targets the next tree: > tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > tag: next-20240411 > --- > drivers/tty/sysrq.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c > index 02217e3c916b..1d1261f618c0 100644 > --- a/drivers/tty/sysrq.c > +++ b/drivers/tty/sysrq.c > @@ -758,11 +758,12 @@ static void sysrq_detect_reset_sequence(struct sysrq_state *state, > static void sysrq_of_get_keyreset_config(void) > { > u32 key; > - struct device_node *np; > struct property *prop; > const __be32 *p; > > - np = of_find_node_by_path("/chosen/linux,sysrq-reset-seq"); > + struct device_node *np __free(device_node) = > + of_find_node_by_path("/chosen/linux,sysrq-reset-seq"); > + Did you run this through checkpatch.pl? Please do so.