All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: "Wang, Xiaoming" <xiaoming.wang@intel.com>
Cc: myungjoo.ham@samsung.com, linux-kernel@vger.kernel.org,
	chuansheng.liu@intel.com, dongxing.zhang@intel.com
Subject: Re: [PATCH] [extcon]:remove freed groups caused the panic or warning in unregister flow
Date: Mon, 04 Nov 2013 10:43:17 +0900	[thread overview]
Message-ID: <5276FBB5.1020506@samsung.com> (raw)
In-Reply-To: <1383346094.2702.16.camel@wxm-ubuntu>

Hi Wang,

>  drivers/extcon/extcon-class.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
> index 148382f..48f4669 100644
> --- a/drivers/extcon/extcon-class.c
> +++ b/drivers/extcon/extcon-class.c
> @@ -794,6 +794,8 @@ void extcon_dev_unregister(struct extcon_dev *edev)
>  		return;
>  	}
>  
> +	device_unregister(edev->dev);
> +
>  	if (edev->mutually_exclusive && edev->max_supported) {
>  		for (index = 0; edev->mutually_exclusive[index];
>  				index++)
> @@ -814,7 +816,6 @@ void extcon_dev_unregister(struct extcon_dev *edev)
>  	if (switch_class)
>  		class_compat_remove_link(switch_class, edev->dev, NULL);
>  #endif
> -	device_unregister(edev->dev);
>  	put_device(edev->dev);
>  }
>  EXPORT_SYMBOL_GPL(extcon_dev_unregister);
> 

I think we could only apply following patch instead of moving the position of device_unregister().

diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 148382f..ff27b19 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -805,10 +805,8 @@ void extcon_dev_unregister(struct extcon_dev *edev)
        for (index = 0; index < edev->max_supported; index++)
                kfree(edev->cables[index].attr_g.name);
 
-       if (edev->max_supported) {
-               kfree(edev->extcon_dev_type.groups);
+       if (edev->max_supported)
                kfree(edev->cables);
-       }
 
 #if defined(CONFIG_ANDROID)
        if (switch_class)

Thanks,
Chanwoo Choi


  parent reply	other threads:[~2013-11-04  1:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 22:48 [PATCH] [extcon]:remove freed groups caused the panic or warning in unregister flow Wang, Xiaoming
2013-11-04  1:06 ` Liu, Chuansheng
2013-11-04  1:43 ` Chanwoo Choi [this message]
2013-11-04  2:07   ` Wang, Xiaoming
2013-11-04  2:36     ` Chanwoo Choi
2013-11-04  3:47       ` Liu, Chuansheng
2013-11-04  4:24         ` Chanwoo Choi

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=5276FBB5.1020506@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=chuansheng.liu@intel.com \
    --cc=dongxing.zhang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=xiaoming.wang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.