linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata
@ 2014-04-09 13:20 Krzysztof Kozlowski
  2014-04-09 13:20 ` [PATCH 2/4] extcon: max77693: Use power efficient workqueue for delayed cable detection Krzysztof Kozlowski
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-09 13:20 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, linux-kernel; +Cc: Krzysztof Kozlowski, stable

Fix NULL pointer exceptions when platform data is not supplied.

Trace of one exception:
Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = c0004000
[00000008] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 2 PID: 1 Comm: swapper/0 Not tainted 3.14.0-12045-gead5dd4687a6-dirty #1628
task: eea80000 ti: eea88000 task.ti: eea88000
PC is at max77693_muic_probe+0x27c/0x528
LR is at regmap_write+0x50/0x60
pc : [<c041d1c8>]    lr : [<c02eba60>]    psr: 20000113
sp : eea89e38  ip : 00000000  fp : c098a834
r10: ee1a5a10  r9 : 00000005  r8 : c098a83c
r7 : 0000000a  r6 : c098a774  r5 : 00000005  r4 : eeb006d0
r3 : c0697bd8  r2 : 00000000  r1 : 00000001  r0 : 00000000
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5387d  Table: 4000404a  DAC: 00000015
Process swapper/0 (pid: 1, stack limit = 0xeea88240)
Stack: (0xeea89e38 to 0xeea8a000)
9e20:                                                       c08499fc eeb006d0
9e40: 00000000 00000000 c0915f98 00000001 00000000 ee1a5a10 c098a730 c09a88b8
9e60: 00000000 c098a730 c0915f98 00000000 00000000 c02d6aa0 c02d6a88 ee1a5a10
9e80: c0a712c8 c02d54e4 00001204 c0628b00 ee1a5a10 c098a730 ee1a5a44 00000000
9ea0: eea88000 c02d57b4 00000000 c098a730 c02d5728 c02d3a24 ee813e5c eeb9d534
9ec0: c098a730 ee22f700 c097c720 c02d4b14 c08174ec c098a730 00000006 c098a730
9ee0: 00000006 c092fd30 c09b8500 c02d5df8 00000000 c093cbb8 00000006 c0008928
9f00: 000000c3 ef7fc785 00000000 ef7fc794 00000000 c08af968 00000072 eea89f30
9f20: ef7fc85e c065f198 000000c3 c003e87c 00000003 00000000 c092fd3c 00000000
9f40: c08af618 c0826d58 00000006 00000006 c0956f58 c093cbb8 00000006 c092fd30
9f60: c09b8500 000000c3 c092fd3c c08e8510 00000000 c08e8bb0 00000006 00000006
9f80: c08e8510 c0c0c0c0 00000000 c0628fac 00000000 00000000 00000000 00000000
9fa0: 00000000 c0628fb4 00000000 c000f038 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 c0c0c0c0 c0c0c0c0
[<c041d1c8>] (max77693_muic_probe) from [<c02d6aa0>] (platform_drv_probe+0x18/0x48)
[<c02d6aa0>] (platform_drv_probe) from [<c02d54e4>] (driver_probe_device+0x140/0x384)
[<c02d54e4>] (driver_probe_device) from [<c02d57b4>] (__driver_attach+0x8c/0x90)
[<c02d57b4>] (__driver_attach) from [<c02d3a24>] (bus_for_each_dev+0x54/0x88)
[<c02d3a24>] (bus_for_each_dev) from [<c02d4b14>] (bus_add_driver+0xe8/0x204)
[<c02d4b14>] (bus_add_driver) from [<c02d5df8>] (driver_register+0x78/0xf4)
[<c02d5df8>] (driver_register) from [<c0008928>] (do_one_initcall+0xc4/0x174)
[<c0008928>] (do_one_initcall) from [<c08e8bb0>] (kernel_init_freeable+0xfc/0x1c8)
[<c08e8bb0>] (kernel_init_freeable) from [<c0628fb4>] (kernel_init+0x8/0xec)
[<c0628fb4>] (kernel_init) from [<c000f038>] (ret_from_fork+0x14/0x3c)
Code: caffffe7 e59d200c e3550001 b3a05001 (e5923008)
---[ end trace 85db969ce011bde7 ]---

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
Fixes: 190d7cfc8632
---
 drivers/extcon/extcon-max77693.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index da268fbc901b..4657a91acf56 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1193,7 +1193,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
 
 
 	/* Initialize MUIC register by using platform data or default data */
-	if (pdata->muic_data) {
+	if (pdata && pdata->muic_data) {
 		init_data = pdata->muic_data->init_data;
 		num_init_data = pdata->muic_data->num_init_data;
 	} else {
@@ -1226,7 +1226,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
 				= init_data[i].data;
 	}
 
-	if (pdata->muic_data) {
+	if (pdata && pdata->muic_data) {
 		struct max77693_muic_platform_data *muic_pdata
 						   = pdata->muic_data;
 
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] extcon: max77693: Use power efficient workqueue for delayed cable detection
  2014-04-09 13:20 [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata Krzysztof Kozlowski
@ 2014-04-09 13:20 ` Krzysztof Kozlowski
  2014-04-09 13:20 ` [PATCH 3/4] extcon: max8997: Fix NULL pointer exception on missing pdata Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-09 13:20 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, linux-kernel; +Cc: Krzysztof Kozlowski

Schedule delayed cable detection work on power efficient workqueue
so the scheduler won't wake up idle core for that work.
This extends the idle time for CPU cores and conserves power.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/extcon/extcon-max77693.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 4657a91acf56..39cd095d103c 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1283,7 +1283,8 @@ static int max77693_muic_probe(struct platform_device *pdev)
 	 * driver should notify cable state to upper layer.
 	 */
 	INIT_DELAYED_WORK(&info->wq_detcable, max77693_muic_detect_cable_wq);
-	schedule_delayed_work(&info->wq_detcable, delay_jiffies);
+	queue_delayed_work(system_power_efficient_wq, &info->wq_detcable,
+			delay_jiffies);
 
 	return ret;
 
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] extcon: max8997: Fix NULL pointer exception on missing pdata
  2014-04-09 13:20 [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata Krzysztof Kozlowski
  2014-04-09 13:20 ` [PATCH 2/4] extcon: max77693: Use power efficient workqueue for delayed cable detection Krzysztof Kozlowski
@ 2014-04-09 13:20 ` Krzysztof Kozlowski
  2014-04-09 13:20 ` [PATCH 4/4] extcon: max8997: Use power efficient workqueue for delayed cable detection Krzysztof Kozlowski
  2014-04-10  3:51 ` [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata Chanwoo Choi
  3 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-09 13:20 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, linux-kernel; +Cc: Krzysztof Kozlowski, stable

Fix NULL pointer exception when platform data is not supplied. The
driver dereferenced pdata pointer where it could be NULL.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
Fixes: 810d601f07c
---
 drivers/extcon/extcon-max8997.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 6a00464658c5..5e1b88cecb76 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -715,7 +715,7 @@ static int max8997_muic_probe(struct platform_device *pdev)
 		goto err_irq;
 	}
 
-	if (pdata->muic_pdata) {
+	if (pdata && pdata->muic_pdata) {
 		struct max8997_muic_platform_data *muic_pdata
 			= pdata->muic_pdata;
 
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] extcon: max8997: Use power efficient workqueue for delayed cable detection
  2014-04-09 13:20 [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata Krzysztof Kozlowski
  2014-04-09 13:20 ` [PATCH 2/4] extcon: max77693: Use power efficient workqueue for delayed cable detection Krzysztof Kozlowski
  2014-04-09 13:20 ` [PATCH 3/4] extcon: max8997: Fix NULL pointer exception on missing pdata Krzysztof Kozlowski
@ 2014-04-09 13:20 ` Krzysztof Kozlowski
  2014-04-10  3:51 ` [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata Chanwoo Choi
  3 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2014-04-09 13:20 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, linux-kernel; +Cc: Krzysztof Kozlowski

Schedule delayed cable detection work on power efficient workqueue
so the scheduler won't wake up idle core for that work.
This extends the idle time for CPU cores and conserves power.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/extcon/extcon-max8997.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 5e1b88cecb76..223e6b068c98 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -770,7 +770,8 @@ static int max8997_muic_probe(struct platform_device *pdev)
 	 * driver should notify cable state to upper layer.
 	 */
 	INIT_DELAYED_WORK(&info->wq_detcable, max8997_muic_detect_cable_wq);
-	schedule_delayed_work(&info->wq_detcable, delay_jiffies);
+	queue_delayed_work(system_power_efficient_wq, &info->wq_detcable,
+			delay_jiffies);
 
 	return 0;
 
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata
  2014-04-09 13:20 [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2014-04-09 13:20 ` [PATCH 4/4] extcon: max8997: Use power efficient workqueue for delayed cable detection Krzysztof Kozlowski
@ 2014-04-10  3:51 ` Chanwoo Choi
  3 siblings, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2014-04-10  3:51 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: MyungJoo Ham, linux-kernel, stable

Hi Krzysztof,

Applied following patchset.

[PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata
[PATCH 2/4] extcon: max77693: Use power efficient workqueue for delayed cable detection
[PATCH 3/4] extcon: max8997: Fix NULL pointer exception on missing pdata
[PATCH 4/4] extcon: max8997: Use power efficient workqueue for delayed cable detection

but, you could check this patch on extcon-next branch
after few days. becuase I have firewall issue of kerner.org.

Thanks,
Chanwoo Choi


On 04/09/2014 10:20 PM, Krzysztof Kozlowski wrote:
> Fix NULL pointer exceptions when platform data is not supplied.
> 
> Trace of one exception:
> Unable to handle kernel NULL pointer dereference at virtual address 00000008
> pgd = c0004000
> [00000008] *pgd=00000000
> Internal error: Oops: 5 [#1] PREEMPT SMP ARM
> Modules linked in:
> CPU: 2 PID: 1 Comm: swapper/0 Not tainted 3.14.0-12045-gead5dd4687a6-dirty #1628
> task: eea80000 ti: eea88000 task.ti: eea88000
> PC is at max77693_muic_probe+0x27c/0x528
> LR is at regmap_write+0x50/0x60
> pc : [<c041d1c8>]    lr : [<c02eba60>]    psr: 20000113
> sp : eea89e38  ip : 00000000  fp : c098a834
> r10: ee1a5a10  r9 : 00000005  r8 : c098a83c
> r7 : 0000000a  r6 : c098a774  r5 : 00000005  r4 : eeb006d0
> r3 : c0697bd8  r2 : 00000000  r1 : 00000001  r0 : 00000000
> Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
> Control: 10c5387d  Table: 4000404a  DAC: 00000015
> Process swapper/0 (pid: 1, stack limit = 0xeea88240)
> Stack: (0xeea89e38 to 0xeea8a000)
> 9e20:                                                       c08499fc eeb006d0
> 9e40: 00000000 00000000 c0915f98 00000001 00000000 ee1a5a10 c098a730 c09a88b8
> 9e60: 00000000 c098a730 c0915f98 00000000 00000000 c02d6aa0 c02d6a88 ee1a5a10
> 9e80: c0a712c8 c02d54e4 00001204 c0628b00 ee1a5a10 c098a730 ee1a5a44 00000000
> 9ea0: eea88000 c02d57b4 00000000 c098a730 c02d5728 c02d3a24 ee813e5c eeb9d534
> 9ec0: c098a730 ee22f700 c097c720 c02d4b14 c08174ec c098a730 00000006 c098a730
> 9ee0: 00000006 c092fd30 c09b8500 c02d5df8 00000000 c093cbb8 00000006 c0008928
> 9f00: 000000c3 ef7fc785 00000000 ef7fc794 00000000 c08af968 00000072 eea89f30
> 9f20: ef7fc85e c065f198 000000c3 c003e87c 00000003 00000000 c092fd3c 00000000
> 9f40: c08af618 c0826d58 00000006 00000006 c0956f58 c093cbb8 00000006 c092fd30
> 9f60: c09b8500 000000c3 c092fd3c c08e8510 00000000 c08e8bb0 00000006 00000006
> 9f80: c08e8510 c0c0c0c0 00000000 c0628fac 00000000 00000000 00000000 00000000
> 9fa0: 00000000 c0628fb4 00000000 c000f038 00000000 00000000 00000000 00000000
> 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 c0c0c0c0 c0c0c0c0
> [<c041d1c8>] (max77693_muic_probe) from [<c02d6aa0>] (platform_drv_probe+0x18/0x48)
> [<c02d6aa0>] (platform_drv_probe) from [<c02d54e4>] (driver_probe_device+0x140/0x384)
> [<c02d54e4>] (driver_probe_device) from [<c02d57b4>] (__driver_attach+0x8c/0x90)
> [<c02d57b4>] (__driver_attach) from [<c02d3a24>] (bus_for_each_dev+0x54/0x88)
> [<c02d3a24>] (bus_for_each_dev) from [<c02d4b14>] (bus_add_driver+0xe8/0x204)
> [<c02d4b14>] (bus_add_driver) from [<c02d5df8>] (driver_register+0x78/0xf4)
> [<c02d5df8>] (driver_register) from [<c0008928>] (do_one_initcall+0xc4/0x174)
> [<c0008928>] (do_one_initcall) from [<c08e8bb0>] (kernel_init_freeable+0xfc/0x1c8)
> [<c08e8bb0>] (kernel_init_freeable) from [<c0628fb4>] (kernel_init+0x8/0xec)
> [<c0628fb4>] (kernel_init) from [<c000f038>] (ret_from_fork+0x14/0x3c)
> Code: caffffe7 e59d200c e3550001 b3a05001 (e5923008)
> ---[ end trace 85db969ce011bde7 ]---
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: <stable@vger.kernel.org>
> Fixes: 190d7cfc8632
> ---
>  drivers/extcon/extcon-max77693.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
> index da268fbc901b..4657a91acf56 100644
> --- a/drivers/extcon/extcon-max77693.c
> +++ b/drivers/extcon/extcon-max77693.c
> @@ -1193,7 +1193,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
>  
>  
>  	/* Initialize MUIC register by using platform data or default data */
> -	if (pdata->muic_data) {
> +	if (pdata && pdata->muic_data) {
>  		init_data = pdata->muic_data->init_data;
>  		num_init_data = pdata->muic_data->num_init_data;
>  	} else {
> @@ -1226,7 +1226,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
>  				= init_data[i].data;
>  	}
>  
> -	if (pdata->muic_data) {
> +	if (pdata && pdata->muic_data) {
>  		struct max77693_muic_platform_data *muic_pdata
>  						   = pdata->muic_data;
>  
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-10  3:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-09 13:20 [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata Krzysztof Kozlowski
2014-04-09 13:20 ` [PATCH 2/4] extcon: max77693: Use power efficient workqueue for delayed cable detection Krzysztof Kozlowski
2014-04-09 13:20 ` [PATCH 3/4] extcon: max8997: Fix NULL pointer exception on missing pdata Krzysztof Kozlowski
2014-04-09 13:20 ` [PATCH 4/4] extcon: max8997: Use power efficient workqueue for delayed cable detection Krzysztof Kozlowski
2014-04-10  3:51 ` [PATCH 1/4] extcon: max77693: Fix two NULL pointer exceptions on missing pdata Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).