Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp114211pxx; Tue, 27 Oct 2020 23:18:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLIlkx7RhhjxS+xd1nYYqU6hjBhVdKuMaZcYwvw0ikxN5J/a1sKk59RrH8sc760yoOM24q X-Received: by 2002:a17:906:ec9:: with SMTP id u9mr6121229eji.400.1603865932467; Tue, 27 Oct 2020 23:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603865932; cv=none; d=google.com; s=arc-20160816; b=HgMyDmtWj20q8s+Xc7qhxS8AH/VSPUYiXUeCqLN+by9qEvrTE8TkF2QqRwVVntP9xz NCEOofreXYXOoC9SGxF7W7Bmj2rWcyPDOcbBysDULUccLMgrr4PI7zFw1MQtAgwb3gyJ tdjkifkUdJG4tcsF9C3Mv/ogcgzIKm3vNDUrmcYK0VbsADwgPYdlFq34BgteBzmQ+4uE G77EE6oYv8Ov+UcTqcCB42fKS/s6clwXN6cmqymXi8VKA0QDGTmnsVEln8d4AMJd20YH 8q92l2F8SbklqaYjajH+Rpa0B/zM9ShqbTESfg2iC8GsQ6LcW+qd9GImgQP2lUkaqAdz aNFQ== 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=KkZwWmEjwnHpFL1m8Vlri/WHg1rK6VrvoHhQzru19fk=; b=kouM/oHXRmtarYFE0/7XaRjgTwASWBMiiTTnlWVciCt4pJ7d4mBsTmCqcU+mG19c7S +QpNNPFxKvEnH2g2QQQg9tZssik7MVyD2vSluejqM3oLxpgd4g5MObgFJWWw0i3giO8r 4nEOqzTO8lOmr16otGjpQzy7cLwEhgSL0W0hJUEiov+JBq8QULKJO2ffreZtQP2P+fSz bDG0ADtZGAU8IjYIIxlwbTohTwNiGQRltSWPqlb0aNY/W9bC1wp5s2vJdEVzY6CMqmMZ KuKGQwto1HpfDGqKailHFXPLkl9WwBmjt975WDB9HZTeF5LpTGOasjZLBdCz+G1QjatC QLQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F63punD+; 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 dn20si3574442ejc.64.2020.10.27.23.18.30; Tue, 27 Oct 2020 23:18:52 -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=F63punD+; 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 S2895626AbgJ0Jdg (ORCPT + 99 others); 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-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