mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Devendra Naga <devendra.aaru@gmail.com>
To: Greg Kroah-Hartman <greg@kroah.com>,
	Teddy Wang <teddy.wang@siliconmotion.com.cn>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: Devendra Naga <devendra.aaru@gmail.com>
Subject: [PATCH 2/2] staging/sm7xxfb: return a proper err for smtc_alloc_fb_info failure
Date: Tue, 10 Jul 2012 11:19:15 +0530	[thread overview]
Message-ID: <1341899355-17387-2-git-send-email-devendra.aaru@gmail.com> (raw)
In-Reply-To: <1341899355-17387-1-git-send-email-devendra.aaru@gmail.com>

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>
---
 drivers/staging/sm7xxfb/sm7xxfb.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index 0c0b603..7395196 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -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);
-- 
1.7.9.5


      reply	other threads:[~2012-07-10  5:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10  5:49 [PATCH 1/2] staging/sm7xxfb: use module_pci_driver macro Devendra Naga
2012-07-10  5:49 ` Devendra Naga [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341899355-17387-2-git-send-email-devendra.aaru@gmail.com \
    --to=devendra.aaru@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=teddy.wang@siliconmotion.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome