Skip to contentSkip to conversation

drm/mgag200: Don't do full cleanup if mgag200_device_init fails

PATCH In review Christopher Harvey 2 participants 3 messages Jun 5, 2013 – Jun 12, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/mgag200: Don't do full cleanup if mgag200_device_init fails

Running mgag200_driver_unload when the driver init fails early on causes functions like drm_mode_config_cleanup to be called. The problem is, drm_mode_config_cleanup crashes because the corresponding init hasn't happend yet. There really isn't anything to cleanup after mgag200_device_init, so we can just pass the error code upwards.

---
 drivers/gpu/drm/mgag200/mgag200_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_main.c +1 -1
index 5189675..6d6b598 100644
@@ -209,7 +209,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
 	r = mgag200_device_init(dev, flags);
 	if (r) {
 		dev_err(&dev->pdev->dev, "Fatal error during GPU init: %d\n", r);
-		goto out;
+		return r;
 	}
 	r = mgag200_mm_init(mdev);
 	if (r)
Signature · 1 line
1.8.1.5
#1 lore raw
Quoted 17 lines · Christopher Harvey

Running mgag200_driver_unload when the driver init fails early on causes functions like drm_mode_config_cleanup to be called. The problem is, drm_mode_config_cleanup crashes because the corresponding init hasn't happend yet. There really isn't anything to cleanup after mgag200_device_init, so we can just pass the error code upwards.

---
 drivers/gpu/drm/mgag200/mgag200_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_main.c +0 -0
index 5189675..6d6b598 100644

drivers/gpu/drm/mgag200/mgag200_main.c int mgag200_driver_load(struct drm_device *dev, unsigned long flags) · line 215

Quoted 8 lines
drivers/gpu/drm/mgag200/mgag200_main.c +1 -1
@@ -209,7 +209,7 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
 	r = mgag200_device_init(dev, flags);
 	if (r) {
 		dev_err(&dev->pdev->dev, "Fatal error during GPU init: %d\n", r);
-		goto out;
+		return r;
 	}
 	r = mgag200_mm_init(mdev);
 	if (r)

ping.

Acked-by on v1 1/1
#2 lore raw
In reply to Christopher Harvey

Dear Christopher,

Am Mittwoch, den 05.06.2013, 11:29 -0400 schrieb Christopher Harvey:

Quoted 11 lines

Running mgag200_driver_unload when the driver init fails early on causes functions like drm_mode_config_cleanup to be called. The problem is, drm_mode_config_cleanup crashes because the corresponding init hasn't happend yet. There really isn't anything to cleanup after mgag200_device_init, so we can just pass the error code upwards.

---
 drivers/gpu/drm/mgag200/mgag200_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

[…]

You should always CC the maintainer when sending in patches.

Thanks,

Paul

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel