From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>,
Samuel Ortiz <sameo@linux.intel.com>,
Richard Purdie <rpurdie@linux.intel.com>
Subject: [PATCH] 88pm860x_bl: fix error handling in pm860x_backlight_probe
Date: Mon, 10 May 2010 09:29:58 +0800 [thread overview]
Message-ID: <1273454998.6536.6.camel@mola> (raw)
This patch includes below fixes:
1. fixes a memory leak by kfree(data) in the case of data->port < 0.
2. properly unregisters a previously registered backlight device object
in error handling
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/video/backlight/88pm860x_bl.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/video/backlight/88pm860x_bl.c
b/drivers/video/backlight/88pm860x_bl.c
index 68d2518..38ffc3f 100644
--- a/drivers/video/backlight/88pm860x_bl.c
+++ b/drivers/video/backlight/88pm860x_bl.c
@@ -222,6 +222,7 @@ static int pm860x_backlight_probe(struct
platform_device *pdev)
data->port = __check_device(pdata, name);
if (data->port < 0) {
dev_err(&pdev->dev, "wrong platform data is assigned");
+ kfree(data);
return -EINVAL;
}
@@ -266,6 +267,7 @@ static int pm860x_backlight_probe(struct
platform_device *pdev)
backlight_update_status(bl);
return 0;
out:
+ backlight_device_unregister(bl);
kfree(data);
return ret;
}
--
1.5.4.3
reply other threads:[~2010-05-10 1:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1273454998.6536.6.camel@mola \
--to=axel.lin@gmail.com \
--cc=haojian.zhuang@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@linux.intel.com \
--cc=sameo@linux.intel.com \
/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