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.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 F3E83C2BA2B for ; Thu, 9 Apr 2020 16:33:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9EB9720769 for ; Thu, 9 Apr 2020 16:33:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="m0bHmXQq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726622AbgDIQdp (ORCPT ); Thu, 9 Apr 2020 12:33:45 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:50606 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726594AbgDIQdp (ORCPT ); Thu, 9 Apr 2020 12:33:45 -0400 Received: from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DCC1072C; Thu, 9 Apr 2020 18:33:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1586450024; bh=1TUMqJKhBAOKvfcP3ShZLw36os3ERuBc/qpJk2r5f5k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m0bHmXQqxGcr0mpJedCqkkzESaRp4DIW8OGHj3XymBA8U4Bs47PBtjdPnyyXVbG2P aOogA4K+uX7KjTE9u5JVvC14dHsOGlHRxiD6kpCkF7zcQeEg/+M8HjulY8n9l1kcZH ExsDEseEH3ZUyU1cd1sQAlp3MA6emqJuhTKxk2PA= Date: Thu, 9 Apr 2020 19:33:33 +0300 From: Laurent Pinchart To: Kieran Bingham Cc: linux-renesas-soc@vger.kernel.org, Jacopo Mondi , Niklas =?utf-8?Q?S=C3=B6derlund?= , Hyun Kwon , Manivannan Sadhasivam Subject: Re: [PATCH v8 02/13] squash! max9286: convert probe kzalloc Message-ID: <20200409163333.GA25086@pendragon.ideasonboard.com> References: <20200409121202.11130-1-kieran.bingham+renesas@ideasonboard.com> <20200409121202.11130-3-kieran.bingham+renesas@ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200409121202.11130-3-kieran.bingham+renesas@ideasonboard.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Hi Kieran, Thank you for the patch. On Thu, Apr 09, 2020 at 01:11:51PM +0100, Kieran Bingham wrote: > v8: > - Convert probe kzalloc usage to devm_ variant This isn't worse than the existing code, but are you aware that devm_* should not be used in this case ? The memory should be allocated with kzalloc() and freed in the .release() operation. > --- > drivers/media/i2c/max9286.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c > index b84d2daa6561..0a43137b8112 100644 > --- a/drivers/media/i2c/max9286.c > +++ b/drivers/media/i2c/max9286.c > @@ -1155,7 +1155,7 @@ static int max9286_probe(struct i2c_client *client) > unsigned int i; > int ret; > > - priv = kzalloc(sizeof(*priv), GFP_KERNEL); > + priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL); > if (!priv) > return -ENOMEM; > > @@ -1232,7 +1232,6 @@ static int max9286_probe(struct i2c_client *client) > max9286_configure_i2c(priv, false); > err_free: > max9286_cleanup_dt(priv); > - kfree(priv); > > return ret; > } > @@ -1253,8 +1252,6 @@ static int max9286_remove(struct i2c_client *client) > > gpiod_set_value_cansleep(priv->gpiod_pwdn, 0); > > - kfree(priv); > - > return 0; > } > -- Regards, Laurent Pinchart