mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonghwa Lee <jonghwa3.lee@samsung.com>
To: anton.vorontsov@linaro.org
Cc: linux-kernel@vger.kernel.org,
	Jonghwa Lee <jonghwa3.lee@samsung.com>,
	Myungjoo Ham <myungjoo.ham@samsung.com>
Subject: [PATCH 2/2] power: charger-manager: Fix a bug when it unregisters notifier block of extcon.
Date: Tue, 25 Jun 2013 14:02:49 +0900	[thread overview]
Message-ID: <1372136569-551-2-git-send-email-jonghwa3.lee@samsung.com> (raw)
In-Reply-To: <1372136569-551-1-git-send-email-jonghwa3.lee@samsung.com>

This patch prevents NULL pointer error cauesed by unregistering unregistered
exton notifier block. At the probing time of charger manager, it tries to
remove extcon notifier block when it fails to initialize them. It has to be
applied for only registered one. Otherwise, it'd make kernel panic. To make it
work right, it checks extcon_specific_cable_nb's extcon_dev node. If extcon
cable notifier block was registered successfully, it has proper extcon_dev
pointer if not so it has NULL pointer.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
---
 drivers/power/charger-manager.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index 7d1bcde..c55a7dc 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -1666,7 +1666,9 @@ err_reg_extcon:
 		charger = &desc->charger_regulators[i];
 		for (j = 0; j < charger->num_cables; j++) {
 			struct charger_cable *cable = &charger->cables[j];
-			extcon_unregister_interest(&cable->extcon_dev);
+			/* Remove notifier block if only edev exists */
+			if (cable->extcon_dev.edev)
+				extcon_unregister_interest(&cable->extcon_dev);
 		}
 
 		regulator_put(desc->charger_regulators[i].consumer);
-- 
1.7.9.5


  reply	other threads:[~2013-06-25  5:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-25  5:02 [PATCH 1/2] power: charger-manager: regulator_get() never returns NULL Jonghwa Lee
2013-06-25  5:02 ` Jonghwa Lee [this message]
     [not found]   ` <CAGTfZH1q8b0VyDsSsFa7DooHbLN46PTYofCRXCYRThnuNRjCwg@mail.gmail.com>
2013-06-26  1:19     ` [PATCH 2/2] power: charger-manager: Fix a bug when it unregisters notifier block of extcon jonghwa3.lee
2013-06-26  1:22       ` Chanwoo Choi
2013-06-25  5:07 ` [PATCH 1/2] power: charger-manager: regulator_get() never returns NULL Sachin Kamat
2013-06-25  5:09   ` jonghwa3.lee

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=1372136569-551-2-git-send-email-jonghwa3.lee@samsung.com \
    --to=jonghwa3.lee@samsung.com \
    --cc=anton.vorontsov@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.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

all inboxes | Powered by JetHome®