Skip to contentSkip to conversation

staging: gma500: fix some swapped gotos

PATCH Applied Dan Carpenter 3 participants 3 messages Feb 26, 2011 – Mar 1, 2011

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

PATCH 1/1 staging: gma500: fix some swapped gotos

These gotos were swapped. In the original code, the first would result in a NULL dereference and the second would result in a memory leak.

drivers/staging/gma500/psb_fb.c +2 -2
index 6585e88..9f4b570 100644
@@ -458,7 +458,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
 	if (!fb) {
 		DRM_ERROR("failed to allocate fb.\n");
 		ret = -ENOMEM;
-		goto out_err0;
+		goto out_err1;
 	}
 	psbfb = to_psb_fb(fb);
 	psbfb->size = size;
@@ -466,7 +466,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
 	info = framebuffer_alloc(sizeof(struct psb_fbdev), device);
 	if (!info) {
 		ret = -ENOMEM;
-		goto out_err1;
+		goto out_err0;
 	}
 
 	info->par = fbdev;
Applied
#1 lore raw
Quoted 5 lines · On Sat, 26 Feb 2011 15:48:12 +0300 Dan Carpenter <[email protected]> wrote:

These gotos were swapped. In the original code, the first would result in a NULL dereference and the second would result in a memory leak.

Applied to my GMA500 tree. Need to sort out with GregKH how we handle stuff in general though as it seems that staging may not work for this driver due to the rate of change in the DRM tree.

Alan

#2 lore raw
In reply to Dan Carpenter
Quoted 7 lines · Alan Cox
Quoted 4 lines · On Sat, 26 Feb 2011 15:48:12 +0300 Dan Carpenter <[email protected]> wrote:

These gotos were swapped. In the original code, the first would result in a NULL dereference and the second would result in a memory leak.

Quoted 5 lines
Quoted 1 line

Applied to my GMA500 tree. Need to sort out with GregKH how we handle stuff in general though as it seems that staging may not work for this driver due to the rate of change in the DRM tree.

I've already applied this to my tree.

And yeah, I'm wondering if this makes sense to go through me, as you are going to be depending on drm changes. Perhaps you want to push it through there instead for the initial merge?

thanks,

greg k-h