[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJMQK-jZgw0Kw0ON8sY=+FFf_Z_Pys48DN+r+g6cCUqcw_7-8A@mail.gmail.com>
Date: Thu, 13 Jan 2022 16:30:20 +0800
From: Hsin-Yi Wang <hsinyi@...omium.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Robert Foss <robert.foss@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Xin Ji <xji@...logixsemi.com>, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
dri-devel@...ts.freedesktop.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Andrzej Hajda <a.hajda@...sung.com>,
Neil Armstrong <narmstrong@...libre.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Sam Ravnborg <sam@...nborg.org>,
Maxime Ripard <maxime@...no.tech>
Subject: Re: [PATCH v2 1/3] drm/bridge: anx7625: Convert to use devm_kzalloc
On Thu, Jan 13, 2022 at 4:04 PM Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
>
> Le 13/01/2022 à 08:31, Hsin-Yi Wang a écrit :
> > Use devm_kzalloc instead of kzalloc and drop kfree(). Let the memory
> > handled by driver detach.
> >
> > Signed-off-by: Hsin-Yi Wang <hsinyi@...omium.org>
> > Reviewed-by: Xin Ji <xji@...logixsemi.com>
> > ---
> > drivers/gpu/drm/bridge/analogix/anx7625.c | 9 +++------
> > 1 file changed, 3 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > index 0b858c78abe8b6..dbe708eb3bcf11 100644
> > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > @@ -2515,7 +2515,7 @@ static int anx7625_i2c_probe(struct i2c_client *client,
> > return -ENODEV;
> > }
> >
> > - platform = kzalloc(sizeof(*platform), GFP_KERNEL);
> > + platform = devm_kzalloc(dev, sizeof(*platform), GFP_KERNEL);
> > if (!platform) {
> > DRM_DEV_ERROR(dev, "fail to allocate driver data\n");
> > return -ENOMEM;
> > @@ -2527,7 +2527,7 @@ static int anx7625_i2c_probe(struct i2c_client *client,
> > if (ret) {
> > if (ret != -EPROBE_DEFER)
> > DRM_DEV_ERROR(dev, "fail to parse DT : %d\n", ret);
> > - goto free_platform;
> > + return ret;
> > }
> >
> > platform->client = client;
> > @@ -2552,7 +2552,7 @@ static int anx7625_i2c_probe(struct i2c_client *client,
> > if (!platform->hdcp_workqueue) {
> > dev_err(dev, "fail to create work queue\n");
> > ret = -ENOMEM;
> > - goto free_platform;
> > + return ret;
> > }
> >
> > platform->pdata.intp_irq = client->irq;
> > @@ -2637,9 +2637,6 @@ static int anx7625_i2c_probe(struct i2c_client *client,
> > if (platform->hdcp_workqueue)
> > destroy_workqueue(platform->hdcp_workqueue);
> >
> > -free_platform:
> > - kfree(platform);
> > -
> > return ret;
> > }
> >
>
> Hi,
>
> you also need to update anx7625_i2c_remove() accordingly, otherwise you
> introduce a double free.
>
Hi,
Updated in v3.
> CJ
>
>
Powered by blists - more mailing lists