Message ID | 20220113082918.2279347-1-hsinyi@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3,1/3] drm/bridge: anx7625: Convert to use devm_kzalloc | expand |
Hey Hsin-Yi, On Thu, 13 Jan 2022 at 09:29, Hsin-Yi Wang <hsinyi@chromium.org> wrote: > > Use devm_kzalloc instead of kzalloc and drop kfree(). Let the memory > handled by driver detach. > > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> > Reviewed-by: Xin Ji <xji@analogixsemi.com> > --- > v2->v3: remove kfree() in anx7625_i2c_remove(). > --- > drivers/gpu/drm/bridge/analogix/anx7625.c | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c > index 0b858c78abe8b6..d3661c78770a8f 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; > } > > @@ -2666,7 +2663,6 @@ static int anx7625_i2c_remove(struct i2c_client *client) > if (platform->pdata.audio_en) > anx7625_unregister_audio(platform); > > - kfree(platform); > return 0; > } > I just had a look at applying this series, but it fails to apply on drm-misc-next today. Could you send a v4 that applies cleanly, and I'll try to be quick about applying it. Rob.
hi Robert, The second patch depends on "drm/bridge: anx7625: send DPCD command to downstream" (https://patchwork.kernel.org/project/dri-devel/patch/1f36f8bf0a48fb2bba17bacec23700e58c1d407d.1641891874.git.xji@analogixsemi.com/). But I'm waiting for Xin Ji's response for that patch. Thanks On Mon, Jan 17, 2022 at 5:40 PM Robert Foss <robert.foss@linaro.org> wrote: > > Hey Hsin-Yi, > > > On Thu, 13 Jan 2022 at 09:29, Hsin-Yi Wang <hsinyi@chromium.org> wrote: > > > > Use devm_kzalloc instead of kzalloc and drop kfree(). Let the memory > > handled by driver detach. > > > > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> > > Reviewed-by: Xin Ji <xji@analogixsemi.com> > > --- > > v2->v3: remove kfree() in anx7625_i2c_remove(). > > --- > > drivers/gpu/drm/bridge/analogix/anx7625.c | 10 +++------- > > 1 file changed, 3 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c > > index 0b858c78abe8b6..d3661c78770a8f 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; > > } > > > > @@ -2666,7 +2663,6 @@ static int anx7625_i2c_remove(struct i2c_client *client) > > if (platform->pdata.audio_en) > > anx7625_unregister_audio(platform); > > > > - kfree(platform); > > return 0; > > } > > > > I just had a look at applying this series, but it fails to apply on > drm-misc-next today. > > Could you send a v4 that applies cleanly, and I'll try to be quick > about applying it. > > > Rob.
On Mon, Jan 17, 2022 at 6:04 PM Hsin-Yi Wang <hsinyi@chromium.org> wrote: > > hi Robert, > > The second patch depends on "drm/bridge: anx7625: send DPCD command to > downstream" (https://patchwork.kernel.org/project/dri-devel/patch/1f36f8bf0a48fb2bba17bacec23700e58c1d407d.1641891874.git.xji@analogixsemi.com/). > But I'm waiting for Xin Ji's response for that patch. > Hi Robert, I've rebased to the latest drm-misc-next and sent v4: https://lore.kernel.org/lkml/20220118092002.4267-1-hsinyi@chromium.org/T/#t I also discussed with Xin Ji about the dependent patch and included it in the series. Thanks. > Thanks > > On Mon, Jan 17, 2022 at 5:40 PM Robert Foss <robert.foss@linaro.org> wrote: > > > > Hey Hsin-Yi, > > > > > > On Thu, 13 Jan 2022 at 09:29, Hsin-Yi Wang <hsinyi@chromium.org> wrote: > > > > > > Use devm_kzalloc instead of kzalloc and drop kfree(). Let the memory > > > handled by driver detach. > > > > > > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> > > > Reviewed-by: Xin Ji <xji@analogixsemi.com> > > > --- > > > v2->v3: remove kfree() in anx7625_i2c_remove(). > > > --- > > > drivers/gpu/drm/bridge/analogix/anx7625.c | 10 +++------- > > > 1 file changed, 3 insertions(+), 7 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c > > > index 0b858c78abe8b6..d3661c78770a8f 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; > > > } > > > > > > @@ -2666,7 +2663,6 @@ static int anx7625_i2c_remove(struct i2c_client *client) > > > if (platform->pdata.audio_en) > > > anx7625_unregister_audio(platform); > > > > > > - kfree(platform); > > > return 0; > > > } > > > > > > > I just had a look at applying this series, but it fails to apply on > > drm-misc-next today. > > > > Could you send a v4 that applies cleanly, and I'll try to be quick > > about applying it. > > > > > > Rob.
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 0b858c78abe8b6..d3661c78770a8f 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; } @@ -2666,7 +2663,6 @@ static int anx7625_i2c_remove(struct i2c_client *client) if (platform->pdata.audio_en) anx7625_unregister_audio(platform); - kfree(platform); return 0; }