Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp288447rdb; Mon, 29 Jan 2024 02:13:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEosRqRifZSi0514oTzjE5b+1/rkCX3qQ1t000JLixt2ILAKzkAXaBoZsA6t07O0+1Q3uUe X-Received: by 2002:ac8:5c12:0:b0:42a:941d:93a8 with SMTP id i18-20020ac85c12000000b0042a941d93a8mr5157699qti.102.1706523194266; Mon, 29 Jan 2024 02:13:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706523194; cv=pass; d=google.com; s=arc-20160816; b=qK1s3oZFwVv4hsDbjy4FxeAvsxffWwgvsLSoBaLkoLu8SyHV4ygbBmM5a+tG4GqSIg bneJ0KiScQXc3ztZFRPi8EfvCsNiCTqsOtYq5hzIY3cqflffrVQnM7UZnozqI7LXqyrL lTr1PBaQo84LwWenzT2/F+Vw28kX4oiwq2DDEjz6zniupg1/PVhfoKtGWSOzbuPLuXBK 4g4klGYlbZRx7rE64gB6MOwSzTrirLhswJovLdR+rPoHhW1n20+BaOYozxODYPfy2Q8q 3+WYjnmiv86H65UbCC6c81FwjT0WEisBqskaOnWOcp3HNvyqLpSUGiSkg3h2m69Qfge6 54wA== 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:sender:dkim-signature; bh=HVJamU9bQQ6+0WvzoygEwXeYOPfoMRXxP8XdjaJOfHo=; fh=jwlBNrARJL90BILxIrv1GOxwbSDKUShXbOWioTZSJ2M=; b=P0fLgpnjtV/H7v7U2mHWa1XQV58oXEC2fVmgmA5aMRfiSYKNIg6JUDW9jLN56M27qQ ytsHlZJZDkMnn+8O6oXdeeRB+C+Ec/pyt8lU2Hp9d+9dvTgwT+QwhuwA10nlMjFQIUpS YFNs3Ko0gh/yUsSsMG5RHafhcgw4o+DMh+YdafmAcD1yEHLK03udn9GU6lvwDWACvpgx mb/R9A9LLpAxxBgs0i2sTHeATy6CuNoWmPjpEWM1/fNjiPKzuzBuFIIWChVKQkenbbD2 xmc3Cv0AhZq6PBvQux7g/sFqoDIWkVPYyuJbSshBM2QEXICoS9B4SKih1TK2jU24SHGb ACjg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=m9t3ppjR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-42522-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b12-20020ac85bcc000000b0042a2f75a7e8si3026257qtb.88.2024.01.29.02.13.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 02:13:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42522-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=m9t3ppjR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-42522-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 F247F1C21E74 for ; Mon, 29 Jan 2024 10:13:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 918BD55E7E; Mon, 29 Jan 2024 10:13:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m9t3ppjR" Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D825755E58; Mon, 29 Jan 2024 10:13:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706523187; cv=none; b=GZKKb2qRu7XkiSqKTVQ5/3c2uFutmCl4bSBWKQ0tiUzRvWvvgBsGltR/3rceBxHdRPS+gqgHlbx4wZT4VrYeDG9KfhuiNabrhLaooivyStQLthbbe3rAU1z1iVTWdmEIdrzkmW5ByTyW8yKrykUMGC68th7w19xXwbNOvGwtkqU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706523187; c=relaxed/simple; bh=WdAQ1iY1kSuqBeRtoPKV93JSO2bOz2pmnfZ8DWSSTUc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jVY3LXOVw3tIJmjcWUHxCJlXxRZCaBBkPzUWbNV5rcHMExyTiOzdOQ2OPNUnIkB4RmupvTsthosVx3j8AKlZmA7UIbwTWjJiPrPkFtET3/OmVSBmxHRr5CkqZ+IujOysRSTN66JY5k0ToREssR1YfObKlpM35XLauklSLBCsRF8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=m9t3ppjR; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-51111e57a66so494848e87.3; Mon, 29 Jan 2024 02:13:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706523184; x=1707127984; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=HVJamU9bQQ6+0WvzoygEwXeYOPfoMRXxP8XdjaJOfHo=; b=m9t3ppjRB0kHW+l3uStsuHANdDD9h4VL5w98xGPg4hwjGt1dEv4GLjdhTeYzfulmyB wGqYs9ZNhJf0U6ZMWOQouuIwvHnuzAG6v7x3h20wI/8bW/ZQw939o8vGgNMgD6JwHm/X 0kA/36OTuF0gWybyolwU/wAuKfbrm7jvOu04GvyIVB0QuViSYIDf+u8Zqq4nhgiyO392 /norghjRbNqpn0TiQFzr4C2wIHSnMvcVX82QEFo4Y28f663SdJuc5jPtSzJEVJSeaNt4 QlBZucuA6zxMCLq6e3ru7deiWG66KM3nrcbgRfaMAX2aK40OnBdjJULMV/FX3vTgpa7T jE+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706523184; x=1707127984; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HVJamU9bQQ6+0WvzoygEwXeYOPfoMRXxP8XdjaJOfHo=; b=mz8RPuk7KIW76r+7nho1HflJPls8Wc6HjzkbYXF1clMyjHOYYaFw4QRIFFvwFPj6Tu aO4ffW7gr3SKAwMcgYIOvtPty4wN+XWqvSkpGEWnCCsGhGZx8COqhaqmn7zMv2U5ivhu 0waEox1F4RJVHrlZZush7KURrh8CmNOU5CToRro+YHIvrfxflFHEuLByuKNs6Tfwuni5 p2BvQAPsAFSzU8lk5i+ZR03O47Ed7VyBvPF52sC2CHbywcSRbEJ3wk1MN8CTEmfwQYMx AvCwFM8flab9CiJA4+K2Clx9mqufeJ96aQIOnUcKzs8V6YV2wbFm9ikkx3uUJ86fs43y V/aQ== X-Gm-Message-State: AOJu0Yx4NjE/rRWVIxSj/zbX5JqAZJVsrtJajIilHb/4aoPrsP99bJps T2wSq0FktKrFkCHy1ZWpQQSODoenxDvcSZx0GSnavuz7gH9J/gbaIAneXJNz3fI= X-Received: by 2002:a05:6512:201c:b0:50e:ca2a:50f8 with SMTP id a28-20020a056512201c00b0050eca2a50f8mr3093547lfb.63.1706523183529; Mon, 29 Jan 2024 02:13:03 -0800 (PST) Received: from gmail.com (1F2EF327.nat.pool.telekom.hu. [31.46.243.39]) by smtp.gmail.com with ESMTPSA id bg42-20020a05600c3caa00b0040e54f15d3dsm13686429wmb.31.2024.01.29.02.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 02:13:02 -0800 (PST) Sender: Ingo Molnar Date: Mon, 29 Jan 2024 11:13:00 +0100 From: Ingo Molnar To: Bartosz Golaszewski Cc: Nathan Chancellor , Thomas Gleixner , x86@kernel.org, linux-tip-commits@vger.kernel.org, maz@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds Subject: Re: [tip: irq/core] genirq/irq_sim: Shrink code by using cleanup helpers Message-ID: References: <20240122124243.44002-5-brgl@bgdev.pl> <170627361652.398.12825437185563577604.tip-bot2@tip-bot2> <20240126210509.GA1212219@dev-arch.thelio-3990X> 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: * Bartosz Golaszewski wrote: > On Fri, 26 Jan 2024 at 22:05, Nathan Chancellor wrote: > > > > > Committer: Thomas Gleixner > > > CommitterDate: Fri, 26 Jan 2024 13:44:48 +01:00 > > > > > > genirq/irq_sim: Shrink code by using cleanup helpers > > > > > > Use the new __free() mechanism to remove all gotos and simplify the error > > > paths. > > > > > > Signed-off-by: Bartosz Golaszewski > > > Signed-off-by: Thomas Gleixner > > > Link: https://lore.kernel.org/r/20240122124243.44002-5-brgl@bgdev.pl > > > > > > --- > > > kernel/irq/irq_sim.c | 25 ++++++++++--------------- > > > 1 file changed, 10 insertions(+), 15 deletions(-) > > > > > > diff --git a/kernel/irq/irq_sim.c b/kernel/irq/irq_sim.c > > > index b0d50b4..fe8fd30 100644 > > > --- a/kernel/irq/irq_sim.c > > > +++ b/kernel/irq/irq_sim.c > > > @@ -4,6 +4,7 @@ > > > * Copyright (C) 2020 Bartosz Golaszewski > > > */ > > > > > > +#include > > > #include > > > #include > > > #include > > > @@ -163,33 +164,27 @@ static const struct irq_domain_ops irq_sim_domain_ops = { > > > struct irq_domain *irq_domain_create_sim(struct fwnode_handle *fwnode, > > > unsigned int num_irqs) > > > { > > > - struct irq_sim_work_ctx *work_ctx; > > > + struct irq_sim_work_ctx *work_ctx __free(kfree) = kmalloc(sizeof(*work_ctx), GFP_KERNEL); > > > + unsigned long *pending; > > > > > > - work_ctx = kmalloc(sizeof(*work_ctx), GFP_KERNEL); > > > if (!work_ctx) > > > - goto err_out; > > > + return ERR_PTR(-ENOMEM); > > > > > > - work_ctx->pending = bitmap_zalloc(num_irqs, GFP_KERNEL); > > > - if (!work_ctx->pending) > > > - goto err_free_work_ctx; > > > + pending = __free(bitmap) = bitmap_zalloc(num_irqs, GFP_KERNEL); > > > > Apologies if this has already been reported elsewhere. This does not > > match what was sent and it causes the build to break with both GCC: > > > > I did not see any other report. I don't know what happened here but > this was a ninja edit as it's not what I sent. If Thomas' intention > was to move the variable declaration and detach it from the assignment > then 'pending' should at least be set to NULL and __free() must > decorate the declaration. > > But the coding style of declaring variables when they're first > assigned their auto-cleaned value is what Linus Torvalds explicitly > asked me to do when I first started sending PRs containing uses of > linux/cleanup.h. Ok - I've rebased tip:irq/core with the original patch. Do you have a reference to Linus's mail about C++ style definition of variables? I can see the validity of the pattern in this context, but it's explicitly against the kernel coding style AFAICS, which I suppose prompted Thomas's edit. I'd like to have an URL handy when the inevitable checkpatch 'fix' gets submitted. ;-) Thanks, Ingo