diff mbox series

[43/51] drm/gm12u320: Use devm_drm_dev_init

Message ID 20200221210319.2245170-44-daniel.vetter@ffwll.ch
State New, archived
Headers show
Series drm managed resources, v2 | expand

Commit Message

Daniel Vetter Feb. 21, 2020, 9:03 p.m. UTC
Only drops the drm_dev_put, but hey a few lines!

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
---
 drivers/gpu/drm/tiny/gm12u320.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Comments

Hans de Goede Feb. 22, 2020, 12:10 p.m. UTC | #1
Hi,

On 2/21/20 10:03 PM, Daniel Vetter wrote:
> Only drops the drm_dev_put, but hey a few lines!
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>

Patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>   drivers/gpu/drm/tiny/gm12u320.c | 19 +++++++------------
>   1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c
> index 5bd26fc6fafa..65dfb87ccb13 100644
> --- a/drivers/gpu/drm/tiny/gm12u320.c
> +++ b/drivers/gpu/drm/tiny/gm12u320.c
> @@ -678,7 +678,7 @@ static int gm12u320_usb_probe(struct usb_interface *interface,
>   	init_waitqueue_head(&gm12u320->fb_update.waitq);
>   
>   	dev = &gm12u320->dev;
> -	ret = drm_dev_init(dev, &gm12u320_drm_driver, &interface->dev);
> +	ret = devm_drm_dev_init(&interface->dev, dev, &gm12u320_drm_driver);
>   	if (ret) {
>   		kfree(gm12u320);
>   		return ret;
> @@ -688,7 +688,7 @@ static int gm12u320_usb_probe(struct usb_interface *interface,
>   
>   	ret = drm_mode_config_init(dev);
>   	if (ret)
> -		goto err_put;
> +		return ret;
>   
>   	dev->mode_config.min_width = GM12U320_USER_WIDTH;
>   	dev->mode_config.max_width = GM12U320_USER_WIDTH;
> @@ -698,15 +698,15 @@ static int gm12u320_usb_probe(struct usb_interface *interface,
>   
>   	ret = gm12u320_usb_alloc(gm12u320);
>   	if (ret)
> -		goto err_put;
> +		return ret;
>   
>   	ret = gm12u320_set_ecomode(gm12u320);
>   	if (ret)
> -		goto err_put;
> +		return ret;
>   
>   	ret = gm12u320_conn_init(gm12u320);
>   	if (ret)
> -		goto err_put;
> +		return ret;
>   
>   	ret = drm_simple_display_pipe_init(&gm12u320->dev,
>   					   &gm12u320->pipe,
> @@ -716,22 +716,18 @@ static int gm12u320_usb_probe(struct usb_interface *interface,
>   					   gm12u320_pipe_modifiers,
>   					   &gm12u320->conn);
>   	if (ret)
> -		goto err_put;
> +		return ret;
>   
>   	drm_mode_config_reset(dev);
>   
>   	usb_set_intfdata(interface, dev);
>   	ret = drm_dev_register(dev, 0);
>   	if (ret)
> -		goto err_put;
> +		return ret;
>   
>   	drm_fbdev_generic_setup(dev, 0);
>   
>   	return 0;
> -
> -err_put:
> -	drm_dev_put(dev);
> -	return ret;
>   }
>   
>   static void gm12u320_usb_disconnect(struct usb_interface *interface)
> @@ -741,7 +737,6 @@ static void gm12u320_usb_disconnect(struct usb_interface *interface)
>   
>   	gm12u320_stop_fb_update(gm12u320);
>   	drm_dev_unplug(dev);
> -	drm_dev_put(dev);
>   }
>   
>   static __maybe_unused int gm12u320_suspend(struct usb_interface *interface,
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c
index 5bd26fc6fafa..65dfb87ccb13 100644
--- a/drivers/gpu/drm/tiny/gm12u320.c
+++ b/drivers/gpu/drm/tiny/gm12u320.c
@@ -678,7 +678,7 @@  static int gm12u320_usb_probe(struct usb_interface *interface,
 	init_waitqueue_head(&gm12u320->fb_update.waitq);
 
 	dev = &gm12u320->dev;
-	ret = drm_dev_init(dev, &gm12u320_drm_driver, &interface->dev);
+	ret = devm_drm_dev_init(&interface->dev, dev, &gm12u320_drm_driver);
 	if (ret) {
 		kfree(gm12u320);
 		return ret;
@@ -688,7 +688,7 @@  static int gm12u320_usb_probe(struct usb_interface *interface,
 
 	ret = drm_mode_config_init(dev);
 	if (ret)
-		goto err_put;
+		return ret;
 
 	dev->mode_config.min_width = GM12U320_USER_WIDTH;
 	dev->mode_config.max_width = GM12U320_USER_WIDTH;
@@ -698,15 +698,15 @@  static int gm12u320_usb_probe(struct usb_interface *interface,
 
 	ret = gm12u320_usb_alloc(gm12u320);
 	if (ret)
-		goto err_put;
+		return ret;
 
 	ret = gm12u320_set_ecomode(gm12u320);
 	if (ret)
-		goto err_put;
+		return ret;
 
 	ret = gm12u320_conn_init(gm12u320);
 	if (ret)
-		goto err_put;
+		return ret;
 
 	ret = drm_simple_display_pipe_init(&gm12u320->dev,
 					   &gm12u320->pipe,
@@ -716,22 +716,18 @@  static int gm12u320_usb_probe(struct usb_interface *interface,
 					   gm12u320_pipe_modifiers,
 					   &gm12u320->conn);
 	if (ret)
-		goto err_put;
+		return ret;
 
 	drm_mode_config_reset(dev);
 
 	usb_set_intfdata(interface, dev);
 	ret = drm_dev_register(dev, 0);
 	if (ret)
-		goto err_put;
+		return ret;
 
 	drm_fbdev_generic_setup(dev, 0);
 
 	return 0;
-
-err_put:
-	drm_dev_put(dev);
-	return ret;
 }
 
 static void gm12u320_usb_disconnect(struct usb_interface *interface)
@@ -741,7 +737,6 @@  static void gm12u320_usb_disconnect(struct usb_interface *interface)
 
 	gm12u320_stop_fb_update(gm12u320);
 	drm_dev_unplug(dev);
-	drm_dev_put(dev);
 }
 
 static __maybe_unused int gm12u320_suspend(struct usb_interface *interface,