skeletonfb: check fb_alloc_cmap return value and handle failure properly
Bad example code, no cookie! Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
5e266e2e0e
commit
0fd853118d
|
@ -795,8 +795,9 @@ static int __devinit xxxfb_probe(struct pci_dev *dev,
|
||||||
if (!retval || retval == 4)
|
if (!retval || retval == 4)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* This has to been done !!! */
|
/* This has to be done! */
|
||||||
fb_alloc_cmap(&info->cmap, cmap_len, 0);
|
if (fb_alloc_cmap(&info->cmap, cmap_len, 0))
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following is done in the case of having hardware with a static
|
* The following is done in the case of having hardware with a static
|
||||||
|
@ -820,8 +821,10 @@ static int __devinit xxxfb_probe(struct pci_dev *dev,
|
||||||
*/
|
*/
|
||||||
/* xxxfb_set_par(info); */
|
/* xxxfb_set_par(info); */
|
||||||
|
|
||||||
if (register_framebuffer(info) < 0)
|
if (register_framebuffer(info) < 0) {
|
||||||
|
fb_dealloc_cmap(&info->cmap);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node,
|
printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node,
|
||||||
info->fix.id);
|
info->fix.id);
|
||||||
pci_set_drvdata(dev, info); /* or platform_set_drvdata(pdev, info) */
|
pci_set_drvdata(dev, info); /* or platform_set_drvdata(pdev, info) */
|
||||||
|
|
Loading…
Reference in a new issue