Received: by 2002:ab2:7407:0:b0:1f4:b336:87c4 with SMTP id e7csp233096lqn; Thu, 11 Apr 2024 22:22:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQ17R4sAPmxTGdpnxHEaghoHXdJf4z2j1y36iPZyRLYnv5F7P8w6xf3i6EX0pIwUimP2G0I6e2TVlRRkn/cIGcPeK3BQ5lMMVZKewnXg== X-Google-Smtp-Source: AGHT+IF3b99xgHTtXa3o7EgQW+TLQ9MwI8Hgx3JSdkRdb/D6W2YviDgJKyGe6PIE48PCAl4fgR+E X-Received: by 2002:a05:6a20:5607:b0:1a3:bd8a:141f with SMTP id ir7-20020a056a20560700b001a3bd8a141fmr1938258pzc.54.1712899347000; Thu, 11 Apr 2024 22:22:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712899346; cv=pass; d=google.com; s=arc-20160816; b=SDp8l/vkNlvv7s/sc5KnE/avAFnLko5QBJ2nSVjP+GJvnR8gQohduCJ+AVm8Y0us+A MN81cT7zTp+yO6fMoNCCrM4LKOOmVhVgRU7xmd1eLmgtSauTVvfyIIvNhcGXpFCRErqM QBTPUH/wfA5g+Pu+jqLLj0AXao/sqqOSf3E10uW42F4haPkp6idgjM+Pg/c+Qxd9fbcc LDfdsT+fl5eA+9SOAKABzO3lqoqhaeecg9Mpc66w2bvyLcBVQKP/ilXv88wmTrqVZt4a mFulCms7GYs3pZmG8YfY5WzFZerR5Jcvm70JFRgsUTALprQ9bt8uhQ9VUkimRBg/GIBr VBkw== 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=yCwylZRkKeG9jQSi4TgtiPk9Csfw3fwW12JjpnZU6BM=; fh=d2uLX7C8aVXfGf+f034rZJIVKZHDtC7m2ff1sxC8oPI=; b=a526VM3q/gDFC6JpGTgYCUJsXq8clJbC2q3B8smpdzZ6BWNKbC4rNWr1patJTsQfLF pocK236fqv3afSMF78ELlc041maQOHCfKoyfHjLFtJzV1IQo7a+oqUkVo15f0qb7zKsc DkBFWmXA3uK4yxdUMEYhFFDw0MOAtvVgoDGoGkLmiphDUKt/MV7D18d4/k9LxFnMfZ71 Pxcvw07ratY07TaOMKWdUiWuOSwWbgW9/nIm5xqBaJiYgpUbx40HJRljD34IDpPpLaFO ER6LIF5VtY24Hbxl6ArEXNUifsu890PTxnAoOiZlhhHsZdB2WVnDTC034HXb2nDCuXVu B8wQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nt8PC0dC; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-141974-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141974-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bk24-20020a17090b081800b002a091584713si2698274pjb.119.2024.04.11.22.22.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 22:22:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141974-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nt8PC0dC; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-141974-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141974-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 10802284949 for ; Fri, 12 Apr 2024 05:22:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89E441B27D; Fri, 12 Apr 2024 05:22:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nt8PC0dC" 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 AA4A8D531; Fri, 12 Apr 2024 05:22:11 +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=1712899331; cv=none; b=tzq0XlpCWeOO3dGuDcgWoBrEZO8a8QrG2k1QhNuQZgZVPqk+9vcmbE2hR3ug0MeMiEVtv4YBtyBe1CrcituYnuW4JIO+k4KziNTMhu4wc0yd1TU4Sc9Hi9/8dI+KX/lka40VMU6MggK8YqLSCiR47Mz37JVBCUoeknmWuvYXfN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712899331; c=relaxed/simple; bh=a5uBuZZAQBvcD3nu0kxCuF0HhAHsxu1HdhHDndDLL3M=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OtuyBsrdIJnvalh/iZseJ8Ujy/M7s6k2hbXpir0dfUUSuZF17tXeAHyosQuUNYhzJEN3xXm/numk38h/uFJBdpQ4QfC9pw92TIiN0xU1NLIpBxEUs39xPPyO5ncOmDYVwreUcqv4ZLqun7LjWDqFed7MsV35Na62TBMGvR5CrEE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nt8PC0dC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A7CEC2BBFC; Fri, 12 Apr 2024 05:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712899331; bh=a5uBuZZAQBvcD3nu0kxCuF0HhAHsxu1HdhHDndDLL3M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nt8PC0dCTBV+JCBeHkrqK4Q3GcKue26HfGwqBA/jVTAwGyhfP5BhPkUabMrXXk/Oe f3cpIbXQKMu3i2ViVuQd1/zHRJYKgpR2dsNv143zsmrDj6K7tUy7gaO4CFph+OTQXD r7cXAZXozVWPf30/7CunBIhbn86xcxImpR/E+me4= Date: Fri, 12 Apr 2024 07:22:07 +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: <2024041222-credit-finally-9580@gregkh> References: <20240411180256.61001-1-romeusmeister@gmail.com> <2024041146-exciting-predefine-05bb@gregkh> 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: On Thu, Apr 11, 2024 at 08:25:10PM +0200, Roman Storozhenko wrote: > Hi Greg, > > This is the output of the checkpatch: > hedin@laptop:~/prj/linux-next$ ./scripts/checkpatch.pl --strict > ~/lkmp/course_tasks/coccinele/patches/sysrq/v1/* > -------------------------------------------------------------------------------- > /home/hedin/lkmp/course_tasks/coccinele/patches/sysrq/v1/0000-cover-letter.patch > -------------------------------------------------------------------------------- > total: 0 errors, 0 warnings, 0 checks, 0 lines checked > > /home/hedin/lkmp/course_tasks/coccinele/patches/sysrq/v1/0000-cover-letter.patch > has no obvious style problems and is ready for submission. > ------------------------------------------------------------------------------------------------------------------------ > /home/hedin/lkmp/course_tasks/coccinele/patches/sysrq/v1/0001-sysrq-Auto-release-device-node-using-__free-attribut.patch > ------------------------------------------------------------------------------------------------------------------------ > total: 0 errors, 0 warnings, 0 checks, 16 lines checked > > /home/hedin/lkmp/course_tasks/coccinele/patches/sysrq/v1/0001-sysrq-Auto-release-device-node-using-__free-attribut.patch > has no obvious style problems and is ready for submission. > > Before sending this patch to the mailing list I sent it to me, > downloaded from the email, and then applied atop of the tree using git > am. Encountered no issues. > > I can guess that you checked the whole file and got some issues. But > those are not related to my changes. > > Thanks, > Roman > > On Thu, Apr 11, 2024 at 8:10 PM Greg KH wrote: > > > > 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. The issue is the blank line in the variable list now. Odd that checkpatch doesn't catch it, which implies the complexity added here might just not be a good idea :( thanks, greg k-h