drivers/video/pnx4008: eliminate double free

The function framebuffer_release just calls kfree, so calling kfree
subsequently on the same argument represents a double free. The comments with
the definition of framebuffer_release in drivers/video/fbsysfs.c suggest that
a more elaborate definition of this function is planned, such that the
splitting up of framebuffer_release and kfree as done in the second instance
might someday make sense, but it does not make sense now.

This was found using the following semantic match.
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression E;
@@

* kfree(E);
...
* framebuffer_release(E);

@@
expression E;
@@

* framebuffer_release(E);
...
* kfree(E);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Vitaly Wool <vitalywool@gmail.com>
Cc: Krzysztof Helt <krzysztof.h1@wp.pl>
Cc: Grigory Tolstolytkin <gtolstolytkin@ru.mvista.com>
Cc: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Julia Lawall and committed by
Linus Torvalds
7a6278e5 5aecd559

+4 -7
+4 -7
drivers/video/pnx4008/pnxrgbfb.c
··· 100 100 fb_dealloc_cmap(&info->cmap); 101 101 framebuffer_release(info); 102 102 platform_set_drvdata(pdev, NULL); 103 - kfree(info); 104 103 } 105 104 106 105 pnx4008_free_dum_channel(channel_owned, pdev->id); ··· 167 168 168 169 ret = fb_alloc_cmap(&info->cmap, 256, 0); 169 170 if (ret < 0) 170 - goto err2; 171 + goto err1; 171 172 172 173 ret = register_framebuffer(info); 173 174 if (ret < 0) 174 - goto err3; 175 + goto err2; 175 176 platform_set_drvdata(pdev, info); 176 177 177 178 return 0; 178 179 179 - err3: 180 - fb_dealloc_cmap(&info->cmap); 181 180 err2: 182 - framebuffer_release(info); 181 + fb_dealloc_cmap(&info->cmap); 183 182 err1: 184 183 pnx4008_free_dum_channel(channel_owned, pdev->id); 185 184 err0: 186 - kfree(info); 185 + framebuffer_release(info); 187 186 err: 188 187 return ret; 189 188 }