Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp474819lqs; Tue, 5 Mar 2024 07:24:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWDbzCOV8EEorYscKh01gL14xpHOCSTyUnaxnAX4oZpJLZgJygDrPUajPgZQy2XMFp7JYCZuke6DtiVPHEjKh20019qU26rBqgG8yAEaA== X-Google-Smtp-Source: AGHT+IGMzQUZcA9bc8pmRGaj+OSBRMWCcCMkeMrVajph0RxXqKZB8MsmG5R/SkZR60yhfP3VT6/h X-Received: by 2002:a05:6e02:1a23:b0:363:be58:cdb0 with SMTP id g3-20020a056e021a2300b00363be58cdb0mr14709001ile.6.1709652288065; Tue, 05 Mar 2024 07:24:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709652288; cv=pass; d=google.com; s=arc-20160816; b=AlM93V2xr+0wnPbcejGvQkpnhPQlbMk2ijlrAwZEeaQxN3qw/htEk0q9H5AlBPu1sL MiVpv3R18s6PrNXCSt3eRvjhx5vDcZmyx59/JLV9obrufS40RkIP/x256g1fGUU/4N6a ANXAY+T2HrQYM3LaTWFlviH0WbniZ02qwAhNnLreRVA5AybWzZIMDfK0OarXd6l+MtqE f+VU8GV5UQCA6BNdXaNlVZiZWJ7HIQv+ShuownW6GJvi9ch88a+CNjE3HszJFjRiVDPi UcD5PyKRdZO7CHM3Pt1hTnOPVKIo+vL5hYx2lwcrCFqXfhlk24UmTE/Lk7PRWptbJ3ew +zng== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=TC7BcVWBBaci9HUeR/cYeDY12xKiEfNlPcIEH+Cc0Io=; fh=PmzxAk5Q7Lr7cMXe+g6zjtpafa+kS1U3xOkxR8ar8TI=; b=AnYPPjum1tu84OtcwPqlHvTNxCSzYvubowJbQFIcqC3H7hTwVffLBdqqd+33PePtIs XAMDK6z/sOLSUnUTU7xHk85pFOWaij8dXHJAZ33sYlzRXPF0lxGLDRMXvzV72nl5aewb V1AOiYikSooqZeKY8R8ACneBVK6rotUI+yB6W38kqnJmmXFKF6GglrZav4tsW3Ttdo8x gamLtnKFMeZPOUKd6LRZndA43qcqXZ9aqdnf5futQuzMCRDpYItUGG93wMaEIKO0chAR MW2bouOQRlGvvvNnqxVSZ3ef13mfU2GVf9wEro3FKwujJSxrW1z68BiFzXXhyq3NHOlM DEHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=UhfaeAnI; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-92597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n15-20020a63ee4f000000b005e42b4bc580si10255213pgk.817.2024.03.05.07.24.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 07:24:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92597-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=@bootlin.com header.s=gm1 header.b=UhfaeAnI; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-92597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 975E8287323 for ; Tue, 5 Mar 2024 15:24:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5ABB21272DD; Tue, 5 Mar 2024 15:24:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="UhfaeAnI" Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 8A6A2126F36; Tue, 5 Mar 2024 15:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709652274; cv=none; b=VWXJLIk/h+VQ1Heg8jODhSx3y6a1ISSPd8fngctjtXhsVhbq2Oezmb3IudNvs7U+JTFyp6ND59+EL0nfhXioXxYNIQoaj1SLV3t0soHHaBBA3IJypjRIZAsteYcRYNV4cvDZvUqSyd00+XTvUKdZYqfKW7bknroB2n+QA0QxufI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709652274; c=relaxed/simple; bh=qjlIRQeJBKz2vz5aisxD5IOrlTqfFDk0KcO4WDSaG8o=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qfal3SQi2DORiOgDSH4FQM8DsTcrpkoPAkTai9h0sIDr9LDW76I2H2FLc4mziCdiz2Ca53W7L9sVbRcUuP6PXRfvze0U9qndIkGrCs0LQ8PDi6LkZ3yKsaGPVeNAX9WkW4KnJ3uhm1DbAlKgRjR7pfQaOTsEtd15w14RRGSVe+M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=UhfaeAnI; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id AFA0EE0002; Tue, 5 Mar 2024 15:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709652269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TC7BcVWBBaci9HUeR/cYeDY12xKiEfNlPcIEH+Cc0Io=; b=UhfaeAnIOQbUnNE6KTFMqs54WVSJT5qGaJYgQ3zmXxYfnYO/oq/KMKfa97O0DFuS4gxDae U84iL5lDUbL8yKfUP6E326+8tw0r6fEKbuaJbuPTQ8VK8KLkZiMkDMuDlTgkXgG3yZY6ZU d3AcO6UMdix9Eh1Gu/9sf616R6xVZRRVZrwuTV20ubPxWpEwYkf5YirxAh+uVBtmSqPcbj Q6z8Z8He8c6kwrH/kBGfsp/Gsl1LV9gDPzt6tJLnK6cd1OmAkKE5V5sgfjjcdXVpuiM+cb +lNq8D9Tj0eBdFA500K4B1GPk64bCDQfOeJf79r465gWkJX4g3oVHcDNWx6t6Q== Date: Tue, 5 Mar 2024 16:24:27 +0100 From: Luca Ceresoli To: Markus Elfring , Dan Carpenter Cc: linux-staging@lists.linux.dev, linux-tegra@vger.kernel.org, linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org, Greg Kroah-Hartman , Jonathan Hunter , Mauro Carvalho Chehab , Sowjanya Komatineni , Thierry Reding , LKML Subject: Re: staging: media: tegra-video: Use common error handling code in tegra_vi_graph_parse_one() Message-ID: <20240305162427.49a9f013@booty> In-Reply-To: References: <20240301183936.505fcc72@booty> <9f1b617f-06cb-4b22-a050-325424720c57@moroto.mountain> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: quoted-printable X-GND-Sasl: luca.ceresoli@bootlin.com Hello Dan, Markus, On Sat, 2 Mar 2024 11:40:26 +0100 Markus Elfring wrote: > >>> Add a jump target so that a bit of exception handling can be better r= eused > >>> at the end of this function implementation. =20 > =E2=80=A6 > >> Reviewed-by: Luca Ceresoli =20 > > > > These patches make the code worse. =20 This is of course a legitimate opinion. However Markus' patch implements what is recommended by the documentation and is in common use in the kernel code. A quick search found 73 occurrences in v6.8-rc7: $ expr $(pcregrep -r -M ':\n\tfwnode_handle_put' drivers | wc -l) / 2 73 $ 300+ are found for of_node_put(). > > If we're in the middle of a loop, > > then we should clean up the partial loop before doing the goto. > > Otherwise it creates a mess when we add a new allocation function after > > the end of the loop. =20 >=20 > How does such a feedback fit to another known information source? >=20 > Section =E2=80=9C7) Centralized exiting of functions=E2=80=9D > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/D= ocumentation/process/coding-style.rst?h=3Dv6.8-rc6#n526 > > > Someone is going to add a _scoped() loop which uses cleanup.h magic to > > call _put automatically. This is a good option. =20 >=20 > I became also curious how scope-based resource management will influence > Linux coding styles further. > Will various collateral evolution become more interesting? After some research I think I found what Dan means: https://lore.kernel.org/all/20240225142714.286440-3-jic23@kernel.org/ After reading the above thread, I agree using *_scoped() macros will be a good improvement. It is not yet in mainline as of v6.8-rc7, but it is in linux-next. So I think despite being valid this patch might still be discarded because a better solution should be available in a few weeks. Luca --=20 Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com