Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp134092pxx; Wed, 28 Oct 2020 00:08:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhmw7xEG1IP8KcfaceGB61PNg6ZsBTAmheI6NAUo1/kFnpMLH55vOuauG+f0BGGUlYYZa4 X-Received: by 2002:a50:ab07:: with SMTP id s7mr6205213edc.287.1603868880548; Wed, 28 Oct 2020 00:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603868880; cv=none; d=google.com; s=arc-20160816; b=i7a+M+bBsNU6rVO1gcKRRYJ9CYLzsnQ3ZWLMouzmszXM8W/gYoXbRU3WCHiNqHgttq c+L2j6i+5rEkp1vZ9Bm2VVVf9f9YqZS1Ndkz3zMeeWg5SKX/Sst5SwDehZgAnJ7Bg4dm 6Cdcp55p87dbu2cOygn/n5my52pVJiP0Un4SVYB8eDPTUDeCqDU1qImeh5Qj6r7BtxFU 2P5HDbzsibD4uDK70Bwc6edx7rrw1uFAibrqLhBCxoViyq+zw3qsUvXPjMD1t0C+i6aR gsdGwUmRC4cHzdW4i5bgPQxG59f3x1YibfaUyGYDd/GYfuOBK2cxOuDVrZMMMJQwc7dA firA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mPsSkKDfaYHYfZBMKhJgybL5r71P6I8MibUMxERzTQ0=; b=EXJfYya0qo/wKTTA84qEURK+dUkgKgjoqu+oKKmv7iZiQ6wY/YKbUFCiLA+LH3KDyh hupLT3rnuuNYSdG7zER3oAC0ehopxX6O1Ms6ubPD6uEFSwMKhk33D5VRv1n/K7EQhMog 0cyp5iudzA/OwZ7RItJ6hF4AV5zLUzuY80vd0p6jMgHsuxoV4Rdylsr6bjpzu5SgVMWe GzrxUMU2n0l0byIzRnChkWVuFR41p4aYAb8P1BZ6JQR2jPfxnk5alVvz7b/+N7rYGDs+ hGR6R5L4saCn36MtwUugrB7kMLRwXzFtSPvoCb3a4vDV7xe2VwP1oQbUddzL0ZHciYZ5 h2kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IjeI9wdS; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si2704001ejk.598.2020.10.28.00.07.38; Wed, 28 Oct 2020 00:08:00 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IjeI9wdS; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2899078AbgJ0LRu (ORCPT + 99 others); Tue, 27 Oct 2020 07:17:50 -0400 Received: from mail-pj1-f65.google.com ([209.85.216.65]:35044 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2509884AbgJ0LRt (ORCPT ); Tue, 27 Oct 2020 07:17:49 -0400 Received: by mail-pj1-f65.google.com with SMTP id h4so583975pjk.0; Tue, 27 Oct 2020 04:17:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mPsSkKDfaYHYfZBMKhJgybL5r71P6I8MibUMxERzTQ0=; b=IjeI9wdSOHdNc1yJ+yQQEI6wi5W7ACIoqnOkxIjXwJdz21jcRAdbTO2C3k5w2dV9AD UuDbDNBdswF/czL3PDU0F3BwEW27/g8X48UjNfvOqSoTS7CQR0GRKCPN9EwYKa7Csukb fOcx2V/P40DWZFct3dt8b4UOeYXrt+SOJyeCTZ7g1QzGVdj3Dwi7eBD73RoVdmtGUzT6 Om/pERqY0bVtgZ0IkE2+uJnB6nEHG2oJpp4Z4wDW0gBbUKdfuvCwqYRcJC99FJzoejjt H4TzH4y/FMMSUvp1hJxZBj9Da53Lqb2Z6ZgwMQu8RXRVwJjDPKm9xcxTZq1+pnHChwng JbQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mPsSkKDfaYHYfZBMKhJgybL5r71P6I8MibUMxERzTQ0=; b=Muj8vHbsmFSGY1PnGe6+4fg/tNNODWriqldszdExZ/whwgmxFP6eW1TcjTB2GCZWRZ guN9zsfwiRnoQ3xsPafyUBlRwdgDe8z7/SQmxoCjkrEgdlFuBjKa1gC/GDOb6qZeb4We +PF9Ya1xqGELk9Svus8PinfpOsBUyoqVWnG+Qx1ipS9jSagBButk/JswRnPV2u4aL1Mj /ciewKl1IL4UR6j3u56sNw/9YNi8Atod9811Vb2ym4K7IcCIGd3XIpA1Yeh/gwSFHxZb kELWJAndatrTA8ibvWBheamxkLZ535Xv+fH82j1inN8yiENDjNeeyf6Oxz+/Swh8UajG ca5g== X-Gm-Message-State: AOAM5315rnim4uPggiiN7zqZpAVFG+sKFUQmTwhAx0wX/WqkG7hTUGlb VSZL9fp/WcvlE/AUeDXAmvDrenljDy7KrNitnKU= X-Received: by 2002:a17:902:6bc8:b029:d6:d9d:f28c with SMTP id m8-20020a1709026bc8b02900d60d9df28cmr1095224plt.17.1603797467528; Tue, 27 Oct 2020 04:17:47 -0700 (PDT) MIME-Version: 1.0 References: <20201026133609.24262-1-brgl@bgdev.pl> <20201026133609.24262-3-brgl@bgdev.pl> In-Reply-To: From: Andy Shevchenko Date: Tue, 27 Oct 2020 13:18:36 +0200 Message-ID: Subject: Re: [PATCH 2/5] iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc() To: Bartosz Golaszewski Cc: Bartosz Golaszewski , Jonathan Cameron , Lars-Peter Clausen , Peter Meerwald-Stadler , Michal Simek , linux-iio , linux-arm Mailing List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 12:40 PM Bartosz Golaszewski wrote: > On Tue, Oct 27, 2020 at 11:29 AM Andy Shevchenko > wrote: > > On Tue, Oct 27, 2020 at 12:04 PM Bartosz Golaszewski wrote: > > > On Tue, Oct 27, 2020 at 10:33 AM Andy Shevchenko > > > wrote: ... > > I meant devm_krealloc(). It should work in this case without your > > additional "fix" patch. > I know, this is why I sent the fix separately. The fix is still > correct on its own. My point is it's not needed. At all. It will actually make a regression. But this is for discussion in that thread. ... > > > Or maybe add devm_krealloc_array() which would perform the checks > > > behind the scenes? > > > > Maybe. But what to do in the cases when you have struct with flexible > > arrays, like > > struct foo { > > ... > > type bar[]; > > }; > > > > ? > > Just use regular devm_krealloc() with struct_size()? > > > > > And you do kzalloc(sizeof(foo)) followed by krealloc(). The above name > > (krealloc_array) may be a bit ambiguous. > > But devm_krealloc_array() would only be useful for memory allocated by > kmalloc_array() or kcalloc(). I don't see what's your point. Naming ambiguity. Here I'm not against it. If you think it's a good idea, go for it! -- With Best Regards, Andy Shevchenko