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=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 72BA9C55179 for ; Tue, 27 Oct 2020 09:33:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 178E32224E for ; Tue, 27 Oct 2020 09:33:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F63punD+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2895630AbgJ0Jdg (ORCPT ); Tue, 27 Oct 2020 05:33:36 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:40177 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409223AbgJ0Jdf (ORCPT ); Tue, 27 Oct 2020 05:33:35 -0400 Received: by mail-pj1-f67.google.com with SMTP id l2so449834pjt.5; Tue, 27 Oct 2020 02:33:34 -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=KkZwWmEjwnHpFL1m8Vlri/WHg1rK6VrvoHhQzru19fk=; b=F63punD+sBQMMAWuFo7w5++PvO3lG9p1IGHfYkS9RxNL75WFDH8vSt4MxpA9cCjla8 yg4l5U9NQyriHJ12H+oL2uSOurxy4l4dJhfWrclWNLoyANZz3eNAA7HXoMGNjSZ3kXsQ iYSHmMfaDauN9y62UlTv7VeBK5o68x2Y9/n5egTdHlm8kDrL87ps3SmRMoLU4MRBTuIy GxlvH+f7sdYypflcdVv35n3/TLok6xum7t4+zgqQsyhuxx84O/OvHdKp3mVg/t3eQ5ye ec3GGT8xw7BMamtZePIGarvTagbDGauXimf+cQK91Z6nHeCFaXTT1piH/8kJovLHPWbO 0wcA== 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=KkZwWmEjwnHpFL1m8Vlri/WHg1rK6VrvoHhQzru19fk=; b=JzUqg1Z4yIaRqIYXfJQCU+1Y0wK0iLXMAmp4Vl4fGNSMN4iCN3rIwyt7dYRDLtMnon E55KB7Z1fbYoOdYFcDU8Fiyo8e05PUXf6Qp0ylqtWR/e8acnt2NQknFd7VKi+qdJf9As Gnqy+0WPN1M53PEiCkCO1JaJs2ANdxA3sud7YJGaxiRIGkvjyGtMbnzqvMR1bptGG7Yl TjLn5WtfEjoAP8iFIF62fSlj/11lFUjs52Ct1MNS22z1bZwuhru5ix3E7OHSBB8dEI8j YmMYLYDRPxK9dQEtmxvCA18whSRKJixJvS3xJKz8Lb2lOyNpzN4aKvy2oyOI9pc33Grv Kv1w== X-Gm-Message-State: AOAM533LmdAoq0I6e4TSkIIhosDMNe12knS5pV1VA1nOBQqbMgzNxkGE cjSuyFUu/6t4g+Z3h9iZhxmrGouWfwMen2XFzI0= X-Google-Smtp-Source: ABdhPJz3bXjuvtcCTEmhQwwCWxLGdJKGh3B5VbvWy8djXjLd1KBydfkoT1N4IxO+HZUx4ocGS26ynCYRPjiN3uE6bFg= X-Received: by 2002:a17:90a:fb92:: with SMTP id cp18mr1259988pjb.228.1603791213713; Tue, 27 Oct 2020 02:33:33 -0700 (PDT) MIME-Version: 1.0 References: <20201026133609.24262-1-brgl@bgdev.pl> <20201026133609.24262-3-brgl@bgdev.pl> In-Reply-To: <20201026133609.24262-3-brgl@bgdev.pl> From: Andy Shevchenko Date: Tue, 27 Oct 2020 11:33:17 +0200 Message-ID: Subject: Re: [PATCH 2/5] iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc() To: Bartosz Golaszewski Cc: Jonathan Cameron , Lars-Peter Clausen , Peter Meerwald-Stadler , Michal Simek , linux-iio , linux-arm Mailing List , Linux Kernel Mailing List , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 26, 2020 at 4:03 PM Bartosz Golaszewski wrote: > > From: Bartosz Golaszewski > > We now have devm_krealloc() in the kernel Use it indstead of calling > kfree() and kcalloc() separately. Which is completely lawful when size > previous_size (I mean, the additional patch you sent previously seems not related to this). > - kfree(xadc->data); > - xadc->data = kcalloc(n, sizeof(*xadc->data), GFP_KERNEL); > + xadc->data = devm_krealloc(indio_dev->dev.parent, xadc->data, > + n * sizeof(*xadc->data), I think you need to use something from overflow.h instead of explicit multiplication here. > + GFP_KERNEL | __GFP_ZERO); -- With Best Regards, Andy Shevchenko