From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31AE9C00528 for ; Mon, 7 Aug 2023 15:07:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbjHGPHJ (ORCPT ); Mon, 7 Aug 2023 11:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbjHGPHB (ORCPT ); Mon, 7 Aug 2023 11:07:01 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96CF91BFF for ; Mon, 7 Aug 2023 08:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691420789; x=1722956789; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=2c+nj8vIWoWHU5yXQEiQFKDo3Rw14j0iZrAqheVIpbc=; b=Rd0hVGKOLHh2Ggj/vbnCLDmUX6PKK1gGgPevNCU0BZptnMOKmOCSH/OF 5e7S0Cws4y0C05v22NFnlePasq107baHqaX5ZAIyafpn6usEXm8IMNykq 93pGKwQaPWkSmnRHUR3JzFo32ES6QWbgvE2zQ0cGUl0xkbqV5bOhyi5cw RCQdVVH5+/sjISuC4ts0AWND+5/NrX/HijUsBWbO3gvClCTD+p/gGq4/P bsjBQe9GM1axffVyb2h7m3U9/phWmVmEWLJyd8hf9k3woaKNOlEJFiCL5 1TszsdFyju2RUubo/2g+rRmtgfNwY52sfpD4Z3kAkxkxdjPwzH78n4S8d A==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="350876157" X-IronPort-AV: E=Sophos;i="6.01,262,1684825200"; d="scan'208";a="350876157" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2023 08:06:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="766030293" X-IronPort-AV: E=Sophos;i="6.01,262,1684825200"; d="scan'208";a="766030293" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga001.jf.intel.com with ESMTP; 07 Aug 2023 08:06:26 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qT1oO-00GdKa-2h; Mon, 07 Aug 2023 18:06:24 +0300 Date: Mon, 7 Aug 2023 18:06:24 +0300 From: Andy Shevchenko To: Marc Zyngier Cc: Johan Hovold , linux-kernel@vger.kernel.org, Thomas Gleixner Subject: Re: [PATCH v1 1/1] irqdomain: Refactor error path in __irq_domain_alloc_fwnode() Message-ID: References: <20230804164932.40582-1-andriy.shevchenko@linux.intel.com> <84f2ea9ee0c08c8826c0f26c4a6291c9@kernel.org> <86cz025tvh.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86cz025tvh.wl-maz@kernel.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 04, 2023 at 11:24:02PM +0100, Marc Zyngier wrote: > On Fri, 04 Aug 2023 21:12:11 +0100, > Andy Shevchenko wrote: > > On Fri, Aug 04, 2023 at 06:33:07PM +0100, Marc Zyngier wrote: > > > On 2023-08-04 17:49, Andy Shevchenko wrote: ... > > > > n = kasprintf(GFP_KERNEL, "irqchip@%pa", pa); > > > > break; > > > > } > > > > - > > > > - if (!fwid || !n) { > > > > + if (!n) { > > > > kfree(fwid); > > > > - kfree(n); > > > > return NULL; > > > > } > > > > > > What are you trying to fix? > > > > I'm not trying to fix anything (there is no such statement from me), > > but I would think of some micro-optimization (speedup boot for > > unnoticeable time? Dunno.). > > Error handling paths rarely qualify as an optimisation. OK. ... > > > We have a common error handling path, which makes it easy to > > > track the memory management. I don't think this sort of bike > > > shedding adds much to the maintainability of this code. > > > > Your call, of course, but I not often see in the kernel two or three attempts > > to allocate some memory and have grouped check for the failure. > > Things like this[1]? Yes. > Well, this is a pattern I use often enough. Maybe > it isn't everybody's taste, but it suits me. Understand. Thanks for review! > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/irqchip/irq-gic-v3-its.c#n3438 -- With Best Regards, Andy Shevchenko