diff mbox

extcon: class: Add NULL pointer checking for removing notifier block.

Message ID 1371175897-3001-1-git-send-email-jonghwa3.lee@samsung.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jonghwa Lee June 14, 2013, 2:11 a.m. UTC
This patch adds NULL pointer checking of extcon device to 'extcon_unregister
_interest' which unregisters extcon notifier block.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
---
 drivers/extcon/extcon-class.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chanwoo Choi June 14, 2013, 7:17 a.m. UTC | #1
On 06/14/2013 11:11 AM, Jonghwa Lee wrote:
> This patch adds NULL pointer checking of extcon device to 'extcon_unregister
> _interest' which unregisters extcon notifier block.
> 
> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
> ---
>  drivers/extcon/extcon-class.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
> index 8c69803..23f11ea 100644
> --- a/drivers/extcon/extcon-class.c
> +++ b/drivers/extcon/extcon-class.c
> @@ -491,7 +491,7 @@ EXPORT_SYMBOL_GPL(extcon_register_interest);
>   */
>  int extcon_unregister_interest(struct extcon_specific_cable_nb *obj)
>  {
> -	if (!obj)
> +	if (!obj || !obj->edev)
>  		return -EINVAL;
>  
>  	return raw_notifier_chain_unregister(&obj->edev->nh, &obj->internal_nb);
> 

Applied it.

Thanks,
Chanwoo Choi
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 8c69803..23f11ea 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -491,7 +491,7 @@  EXPORT_SYMBOL_GPL(extcon_register_interest);
  */
 int extcon_unregister_interest(struct extcon_specific_cable_nb *obj)
 {
-	if (!obj)
+	if (!obj || !obj->edev)
 		return -EINVAL;
 
 	return raw_notifier_chain_unregister(&obj->edev->nh, &obj->internal_nb);