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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=BAYES_00,DATE_IN_PAST_03_06, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84590C4741F for ; Fri, 25 Sep 2020 16:41:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 498F1206BE for ; Fri, 25 Sep 2020 16:41:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729557AbgIYQlE (ORCPT ); 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