Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1246384pxk; Fri, 25 Sep 2020 09:43:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxM8md1CKueyPvf9lqvEof0dYeLaen65L983l/V2olNNILEps/3fawL15ToLzIeyvPvhPOU X-Received: by 2002:aa7:c1c3:: with SMTP id d3mr2294615edp.228.1601052182499; Fri, 25 Sep 2020 09:43:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601052182; cv=none; d=google.com; s=arc-20160816; b=ra2JmrqM9rEIBdAM7wpCYGdtKM09iQRkfkEjujagwPns5kpmaCOE9nEpgQojgrWG9T XsLdYPnWoBlLFq6e8FcDGTS2oiSG8kxkzO1go6FHUAJC59TfF68OF7h6uNNk2xBdQgsD KE7/GpmPyDOwLtamB2onuTUYT1CyirsuIqxmkNLKf5nMouRP6LafR+atfFglh7vbMu/o KymhAjU5l2eHwzQyRR8I5ylMJM1+maOUQ1ol4kkdDwPPhikgaHqBoDUkJ4H9h6+eyRJ/ n9dTN5Gp6Xs38tRuQ6kfqPIbaJF78H+YISP88+IYBHQyEQy5hUP7IeM35DFbkl0dcgGT hwJw== 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 :ironport-sdr:ironport-sdr; bh=wN6+TCTTEF3BjRQo/4ii2b5lTkRTOxxt84himZE/2t4=; b=pCBo+Q/vrTVe4t4ON6fVxCtBHHGcFzivYOfAN9GR1zXXfT3s/m+VHGAyBZPtacm5k8 W8MiYAQOPadCuQDLL8FrKiLYz9+MJE8b2aPRWCqD1ag7CfQDtW6aXK+0C85x4uABpXD/ P77ioPOkdArl8vjOGT6eki52+SYuRTX0nwVZ5XG67e8yCAdEhEN52QCU3KreBifpbZaQ W6Wsl78h4uYYjqLu4anDU6EgUEYx5MlE4UwW61DbtqFpf3TSGb1se4eEMQ6ABKC/9O/R Hur6GhtToKnQB/e6XHE01EW4DSIwgnWA9+lyvDq+mMRP5QrpAYJ+uANddqOI2qwikorC f6WA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si2064250ejr.560.2020.09.25.09.42.39; Fri, 25 Sep 2020 09:43:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729431AbgIYQlE (ORCPT + 99 others); Fri, 25 Sep 2020 12:41:04 -0400 Received: from mga11.intel.com ([192.55.52.93]:19942 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbgIYQlE (ORCPT ); Fri, 25 Sep 2020 12:41:04 -0400 IronPort-SDR: Me5HzumdUfC+imb3Npr9D4Ls0HY4wWssDNmmh1r4DWJfKa1go19jGXOpYJEbTbZCr2ARTjV2X8 JDB9UBMHG1yQ== X-IronPort-AV: E=McAfee;i="6000,8403,9755"; a="158936131" X-IronPort-AV: E=Sophos;i="5.77,302,1596524400"; d="scan'208";a="158936131" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 09:41:03 -0700 IronPort-SDR: Qbg96RyIDZE69SpY8G9y5rk466eek6K/vAeSIASoTig1Amupl9y1Wwvs6ovpTjLiLrP8bQzL4h cu4S3r4Vf5SA== X-IronPort-AV: E=Sophos;i="5.77,302,1596524400"; d="scan'208";a="413872238" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2020 09:41:01 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kLmpW-001ut5-Gl; Fri, 25 Sep 2020 15:28:02 +0300 Date: Fri, 25 Sep 2020 15:28:02 +0300 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Bartosz Golaszewski , Linus Walleij , Jonathan Corbet , Kent Gibson , linux-gpio , linux-doc , LKML Subject: Re: [PATCH 1/9] lib: string_helpers: provide kfree_strarray() Message-ID: <20200925122802.GC3956970@smile.fi.intel.com> References: <20200924113842.11670-1-brgl@bgdev.pl> <20200924113842.11670-2-brgl@bgdev.pl> <20200925084804.GX3956970@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Sep 25, 2020 at 01:32:01PM +0200, Bartosz Golaszewski wrote: > On Fri, Sep 25, 2020 at 11:01 AM Andy Shevchenko > wrote: > > > > On Thu, Sep 24, 2020 at 01:38:34PM +0200, Bartosz Golaszewski wrote: > > > From: Bartosz Golaszewski > > > > > > There's a common pattern of dynamically allocating an array of char > > > pointers and then also dynamically allocating each string in this > > > array. Provide a helper for freeing such a string array with one call. > > > > For consistency I would like to provide kalloc_strarray(), but it seems a bit > > ambiguous. So I'm fine with this going alone. > > > > But how would it even work - you can allocate strings in so many ways? Yes, that's what I meant in the second part of the first sentence. Something like: static inline char **kalloc_strarray(n, gfp) { return kcalloc(n, sizeof(char *), gfp); } looks good enough, but it's only first part of the equation. > Also: let's not introduce functions without users. Agree. -- With Best Regards, Andy Shevchenko