Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp441236rwb; Fri, 4 Aug 2023 15:42:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsk7P1O9HnYZl8+o5575dvSu/RIkGMSFFwYA6tvXfp5fQmSOXlN1kSZ1scdEnT9TN3FZq6 X-Received: by 2002:a17:906:108f:b0:994:1880:dc32 with SMTP id u15-20020a170906108f00b009941880dc32mr950630eju.17.1691188975253; Fri, 04 Aug 2023 15:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691188975; cv=none; d=google.com; s=arc-20160816; b=kly0QhDRu0IALUna1szZjyM0UyKT0OtX8wGVzBArsm2/7SjDiBYS3BH2GvdyJfwW8O 9YncNz4HKY/KJ8OvDsEThtjkJKHz7136hr0INWB8XlmR8Qh+zU2ub4XkT4eu9pyNEFkA 0Vy0z747Zk3UNAGIKiTycmrrv7ojuKrmauH3aj6rplBCWEJ5SWAZLIWeasvo1xFX9Zsv 46Hbl4Vcgo1J3i+w2odEktmnCA/jfXIeb9QbID5MzYFhJh1tRAU4CicuYD3AzsFyB+eK jGu3pmtAe84jjEPffwA3SsUsYzP/xRy+XnQ7oDDEKTeJPf/JdSXT8ejykvAHw3D4Z8Jm JmwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=wmVE4Z90Uf91Z6VauPdxa6GvEoC+BwNNGJ/nYCJ1huA=; fh=OPPCiU2zeaT9vOc3ugE943+/P0g1vfslnUqip+TkVgQ=; b=tLqLXMIcm5tFDcWaRfzFb/vwK0TbUbY5UUgzC7OqSJWWJ0k8I3jA7wQAMfxdhkJMxD O8G99utYk9684HuNLShAtq8i+roZRQZFal8onhIgqcv9uhOyzZ7L/HceXwqvCx+A6bb9 O7WYcF1Hpts2BXPqw74QO4fAGbcEr3IOhdH+yTsxktrdxvfrmIcJOY1Q/q80squ2fU3l 4nDeCselXlpA7ewO5OKF7UB/aPZuTz1TwnVxmIBT47cQ9k6JrjXLmq9sK3Ij46QButlP 8hoJWdhceUT9SZPGviydaAyjRU+QRAlhTJzx4pSPY4vjJHwOuWLP+xBD5p6FWkXFJBjc lzMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ORpv5c7S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a17090682ca00b00991cb7517bdsi2283651ejy.948.2023.08.04.15.42.30; Fri, 04 Aug 2023 15:42:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ORpv5c7S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229707AbjHDUMc (ORCPT + 99 others); Fri, 4 Aug 2023 16:12:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbjHDUMQ (ORCPT ); Fri, 4 Aug 2023 16:12:16 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B36A3A8C for ; Fri, 4 Aug 2023 13:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691179935; x=1722715935; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+hQ4vNpCTz70OaKtz2FBTdqtkBD+Xe76/s5giJCLmwg=; b=ORpv5c7SSnAZpNVq5QnFpc3d+hWizjlRfOVGTG0BOR7+aoqVMzsTqKAZ /hAe2GdWEt1r5qVZix/AZGpfGRG/gOKzOKk53v953hRPTzGzYDWplNoyd byyrs3c1qm/Pm5da2efc7rXNcB5ZQjAhtUK59UMDGY7y0qYik25YzTYNl 6IpMbjb3Sn8UI+cHC+U/scPnx6Dk8+5DwNawWXqibvyh9lSKHc+esI6Nu 85S7u2/YSh1dCCeuv+hbwLGpp1vqUYgxD2poKWrA8QreS07+oSOKC5EaS 5Ii50pFyKblWxO2bnHEkI65BTW7dJv2xHt3iZ2v/kSC59OyCtpbQ93B2G w==; X-IronPort-AV: E=McAfee;i="6600,9927,10792"; a="436561933" X-IronPort-AV: E=Sophos;i="6.01,255,1684825200"; d="scan'208";a="436561933" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Aug 2023 13:12:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10792"; a="765239145" X-IronPort-AV: E=Sophos;i="6.01,255,1684825200"; d="scan'208";a="765239145" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga001.jf.intel.com with ESMTP; 04 Aug 2023 13:12:13 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qS19g-006GOO-06; Fri, 04 Aug 2023 23:12:12 +0300 Date: Fri, 4 Aug 2023 23:12:11 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <84f2ea9ee0c08c8826c0f26c4a6291c9@kernel.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 04, 2023 at 06:33:07PM +0100, Marc Zyngier wrote: > On 2023-08-04 17:49, Andy Shevchenko wrote: > > First of all, there is no need to call kasprintf() if the previous > > allocation failed. Second, there is no need to call for kfree() > > when we know that its parameter is NULL. Refactor the code accordingly. ... > > 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.). > 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. > Now if you have spotted an actual bug, I'm all ears. -- With Best Regards, Andy Shevchenko