Skip to content

Commit

Permalink
staging/sm7xxfb: return a proper err for smtc_alloc_fb_info failure
Browse files Browse the repository at this point in the history
as smtc_alloc_fb_info can fail, but we are returning the 0,
how? because the pci_enable_device succeeded, which makes the probe
return 0, and may cause panics or some strange problems at remove
when driver unloaded by modprobe -r.

so return err properly as smtc_alloc_fb_info is doing kzallocs its
good to do -ENOMEM

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Devendra Naga authored and Greg Kroah-Hartman committed Jul 12, 2012
1 parent e6345c8 commit fd67859
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/staging/sm7xxfb/sm7xxfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,10 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,

sfb = smtc_alloc_fb_info(pdev, name);

if (!sfb)
if (!sfb) {
err = -ENOMEM;
goto failed_free;
}

sfb->chip_id = ent->device;
sprintf(name, "sm%Xfb", sfb->chip_id);
Expand Down

0 comments on commit fd67859

Please sign in to comment.