RE: [PATCH] [extcon]:remove freed groups caused the panic orwarning in unregister flow

From: Liu, Chuansheng
Date: Sun Nov 03 2013 - 22:47:51 EST




> -----Original Message-----
> From: Chanwoo Choi [mailto:cw00.choi@xxxxxxxxxxx]
> Sent: Monday, November 04, 2013 10:37 AM
> To: Wang, Xiaoming
> Cc: myungjoo.ham@xxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Liu,
> Chuansheng; Zhang, Dongxing
> Subject: Re: [PATCH] [extcon]:remove freed groups caused the panic or warning
> in unregister flow


> As you comment, my opinion has memory leak problem. My mistake.
> But, I prefer to call 'device_unregister' at the end of extcon_dev_unregister().
> To resolve kernel panic, I think we could use 'devm_kzalloc' instead of
> kzalloc/kfree.
> What is your opinion about my approach?
>
That sounds good.
But in function extcon_dev_register(), the device attributes are allocated before device_register(),
and before device_register(), the function devm_kzalloc() can not be used.


¢éì®&Þ~º&¶¬–+-±éÝ¥Šw®žË±Êâmébžìdz¹Þ)í…æèw*jg¬±¨¶‰šŽŠÝj/êäz¹ÞŠà2ŠÞ¨è­Ú&¢)ß«a¶Úþø®G«éh®æj:+v‰¨Šwè†Ù>Wš±êÞiÛaxPjØm¶Ÿÿà -»+ƒùdš_