All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] drm/bridge: anx7625: Convert to use devm_kzalloc
@ 2022-01-13  7:31 ` Hsin-Yi Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Hsin-Yi Wang @ 2022-01-13  7:31 UTC (permalink / raw)
  To: Robert Foss, Rob Herring, Xin Ji
  Cc: David Airlie, Daniel Vetter, Laurent Pinchart, dri-devel,
	devicetree, linux-kernel, Andrzej Hajda, Neil Armstrong,
	Jonas Karlman, Jernej Skrabec, Sam Ravnborg, Maxime Ripard

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>
---
 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;
 }
 
-- 
2.34.1.575.g55b058a8bb-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-13  8:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13  7:31 [PATCH v2 1/3] drm/bridge: anx7625: Convert to use devm_kzalloc Hsin-Yi Wang
2022-01-13  7:31 ` Hsin-Yi Wang
2022-01-13  7:31 ` [PATCH v2 2/3] drm/bridge: anx7625: Support reading edid through aux channel Hsin-Yi Wang
2022-01-13  7:31   ` Hsin-Yi Wang
2022-01-13  7:31 ` [PATCH v2 3/3] dt-bindings: drm/bridge: anx7625: Add aux-bus node Hsin-Yi Wang
2022-01-13  7:31   ` Hsin-Yi Wang
2022-01-13  8:04 ` [PATCH v2 1/3] drm/bridge: anx7625: Convert to use devm_kzalloc Christophe JAILLET
2022-01-13  8:04   ` Christophe JAILLET
2022-01-13  8:30   ` Hsin-Yi Wang
2022-01-13  8:30     ` Hsin-Yi Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.