[Letux-kernel] weird problem with pwm_bl on omap3

H. Nikolaus Schaller hns at goldelico.com
Thu May 17 14:15:07 CEST 2018


Hi Tony,
we are using for long time the dmtimer/pwm on
the GTA04 to drive the display panel backlight.

Starting a while ago (I am not sure when, but it may
be 4.17-rc1), the device randomly fails to boot
with a NULL pointer dereference in strcmp().
Booting again usually runs fine.

By experiments I could trace it down to the
probe() function of the pwm_bl driver to return
-EPROBE_DEFER and then we get the strcmp(NULL)
as shown below.

If probing succeeds immediately, or if I block
the driver and load it manually, there is no
such problem.

So what I suspect is that something in the
probe function is no longer defer-safe and the
EPROBE_DEFER leaves something in an uninitialized
state so that pinctrl_get_group_selector() fails.

Here is an excerpt of the console log where I have
added multiple printk() to show the driver stages:

[    6.372589] bq27xxx_battery_settings: power_supply_get_battery_info failed ret=-1088020460
[    6.406463] omap3isp 480bc000.isp: 480bc000.isp supply vdd-csiphy2 not found, using dummy regulator
[    6.537994] pwm_backlight_probe
[    6.554565] omap3isp 480bc000.isp: Revision 15.0 found
[    6.587829] pwm-backlight backlight: backlight supply power not found, using dummy regulator
[    6.618377] omap-iommu 480bd400.mmu: 480bd400.mmu: version 1.1
[    6.665252] wwan_on_off_init: wwan_on_off_init
[    6.673187] omap3isp 480bc000.isp: Entity type for entity OMAP3 ISP CCP2 was not initialized!
[    6.684143] pwm_backlight_probe 4 err=-517
[    6.692108] pps_core: LinuxPPS API ver. 1 registered
[    6.709259] pwm_backlight_probe err=-517
[    6.714050] (NULL device *): hwmon: 'gta04-battery' is not a valid name attribute, please fix
[    6.723266] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti at linux.it>
[    6.734191] omap3isp 480bc000.isp: Entity type for entity OMAP3 ISP CSI2a was not initialized!
[    6.771423] ov9655 1-0030: ov9655_probe
[    6.775543] ov9655 1-0030: 1-0030 supply dvdd not found, using dummy regulator
[    6.791290] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[    6.800109] ov9655 1-0030: 1-0030 supply dovdd not found, using dummy regulator
[    6.810119] omap3isp 480bc000.isp: Entity type for entity OMAP3 ISP CCDC was not initialized!
[    6.830413] pgd = (ptrval)
[    6.836334] [00000000] *pgd=be109831
[    6.840118] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[    6.845764] Modules linked in: snd_soc_simple_card(+) pps_gpio(+) snd_soc_simple_card_utils snd_soc_omap_twl4030(+) pps_core encoder_opa362 wwan_on_off(+) snd_soc_gtm601 pwm_omap_dmtimer connector_analog_tv generic_adc_battery pwm_bl bq27xxx_battery_hdq bq27xxx_battery omap3_isp(+) bmp280_spi videobuf2_dma_contig wlcore_sdio videobuf2_memops videobuf2_v4l2 videobuf2_common omap_hdq omap2430 ov9655 v4l2_fwnode v4l2_common bmp280_i2c bmp280 at24 tsc2007 videodev bmc150_accel_i2c leds_tca6507 bmc150_magn_i2c bmc150_accel_core bmc150_magn industrialio_triggered_buffer phy_twl4030_usb snd_soc_omap_mcbsp bno055 kfifo_buf media snd_soc_omap snd_pcm_dmaengine musb_hdrc gpio_twl4030 twl4030_charger twl4030_madc snd_soc_twl4030 twl4030_vibra twl4030_pwrbutton industrialio gnss_w2sg0004 gnss w2cbw003_bluetooth
[    6.919921]  ehci_omap omapdss omapdss_base cec
[    6.924682] CPU: 0 PID: 1151 Comm: udevd Not tainted 4.17.0-rc5-letux+ #2332
[    6.932037] Hardware name: Generic OMAP36xx (Flattened Device Tree)
[    6.938598] PC is at strcmp+0x0/0x34
[    6.942352] LR is at pinctrl_get_group_selector+0x44/0x78
[    6.947998] pc : [<c070d16c>]    lr : [<c0429aac>]    psr: a00f0013
[    6.954559] sp : ee7ebd00  ip : ed232590  fp : 0000001e
[    6.959991] r10: 0000001d  r9 : ed24ce00  r8 : 0000001e
[    6.965454] r7 : c074dce8  r6 : ef7c4c3c  r5 : ee430600  r4 : 0000001b
[    6.972290] r3 : c0427cf0  r2 : 00000000  r1 : ef7c4c3c  r0 : 00000000
[    6.979095] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[    6.986541] Control: 10c5387d  Table: ae7f0019  DAC: 00000051
[    6.992553] Process udevd (pid: 1151, stack limit = 0x(ptrval))
[    6.998748] Stack: (0xee7ebd00 to 0xee7ec000)
[    7.003295] bd00: ee430600 ef7c4c3c 00000000 ed1fbc10 00000000 c042aa6c ed249050 00000001
[    7.011840] bd20: 00000002 ed249080 ed24ce40 ed24ce80 ed1fbc10 00000000 00000000 ed24ce00
[    7.020385] bd40: 00000000 c04292d4 00000014 ee25be40 c0a58e30 c088091c ee2a7a10 00000000
[    7.028930] bd60: ed249110 ee2a7a10 c0aca944 fffffdfb bf292020 00000031 00000000 c042949c
[    7.037475] bd80: 00000000 ee2a7a10 ed2490d0 c04bbb98 ee2a7a10 00000000 c0aca948 c049fe90
[    7.046020] bda0: ee2a7a10 ee2a7a44 bf292020 c0a632d0 bf292180 bf2921b0 00000000 c04a0140
[    7.054565] bdc0: ee2a7a10 bf292020 c04a00c0 c049e634 ee01be58 ee220134 bf292020 00000000
[    7.063110] bde0: ed1e8500 c049f4cc bf291727 bf291728 00000000 bf292020 c0a94300 bf295000
[    7.071655] be00: 00000000 c04a0ce4 c04a1504 bf292080 c0a94300 c0102d74 014000c0 c07045a0
[    7.080200] be20: bf2920c8 ed240a48 ed240980 c087ef65 ed23c780 bf292080 00000001 ed240a64
[    7.088745] be40: ed23c7c0 a00f0013 ed23c800 ed23c780 ee000000 014000c0 bf292080 ee7ebf50
[    7.097320] be60: bf29208c bf292080 ee7ebf50 ed23c800 00000000 c01a3ffc bf292080 ed23c800
[    7.105865] be80: bf292080 ee7ebf50 bf29208c c01a2e2c ffff8000 00007fff bf292080 c01a015c
[    7.114410] bea0: 00000075 c071f138 f0be990c b6d789f8 00000000 00000003 ed02c540 0000295c
[    7.122955] bec0: 00000000 c0249928 00000003 00000000 00000000 00000000 00000000 00000000
[    7.131500] bee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    7.140045] bf00: 00000000 00000000 7fffffff 00000000 b6d789f8 00000006 0000017b c01011e4
[    7.148559] bf20: ee7ea000 00000000 00065fc8 c01a31b0 7fffffff 00000000 00000003 c0213c88
[    7.157135] bf40: 00000002 f0be7000 0000295c 00000000 f0be7bbe f0be7000 0000295c f0be9394
[    7.165679] bf60: f0be81b7 f0be8a98 00003000 000031b0 00000000 00000000 00000000 00001c1c
[    7.174194] bf80: 00000023 00000024 0000001b 00000000 00000017 00000000 b6d797d4 00051f80
[    7.182769] bfa0: 1a3b3500 c0101000 b6d797d4 00051f80 00000006 b6d789f8 00000000 b6d7931c
[    7.191314] bfc0: b6d797d4 00051f80 1a3b3500 0000017b 00020000 00037f78 00050048 00065fc8
[    7.199859] bfe0: be856ee0 be856ed0 b6d72c4b b6e7da42 60070030 00000006 00000000 00000000
[    7.208404] [<c070d16c>] (strcmp) from [<c0429aac>] (pinctrl_get_group_selector+0x44/0x78)
[    7.217041] [<c0429aac>] (pinctrl_get_group_selector) from [<c042aa6c>] (pinmux_map_to_setting+0x158/0x1a0)
[    7.227203] [<c042aa6c>] (pinmux_map_to_setting) from [<c04292d4>] (create_pinctrl+0x1f0/0x2f8)
[    7.236297] [<c04292d4>] (create_pinctrl) from [<c042949c>] (devm_pinctrl_get+0x2c/0x6c)
[    7.244750] [<c042949c>] (devm_pinctrl_get) from [<c04bbb98>] (pinctrl_bind_pins+0x3c/0x138)
[    7.253570] [<c04bbb98>] (pinctrl_bind_pins) from [<c049fe90>] (driver_probe_device+0xe8/0x318)
[    7.262664] [<c049fe90>] (driver_probe_device) from [<c04a0140>] (__driver_attach+0x80/0xa4)
[    7.271484] [<c04a0140>] (__driver_attach) from [<c049e634>] (bus_for_each_dev+0x58/0x7c)
[    7.280029] [<c049e634>] (bus_for_each_dev) from [<c049f4cc>] (bus_add_driver+0xcc/0x1e0)
[    7.288604] [<c049f4cc>] (bus_add_driver) from [<c04a0ce4>] (driver_register+0x9c/0xe0)
[    7.296966] [<c04a0ce4>] (driver_register) from [<c0102d74>] (do_one_initcall+0xb4/0x248)
[    7.305511] [<c0102d74>] (do_one_initcall) from [<c01a3ffc>] (do_init_module+0x58/0x1d0)
[    7.313934] [<c01a3ffc>] (do_init_module) from [<c01a2e2c>] (load_module+0xe04/0xfb0)
[    7.322113] [<c01a2e2c>] (load_module) from [<c01a31b0>] (sys_finit_module+0x88/0x90)
[    7.330291] [<c01a31b0>] (sys_finit_module) from [<c0101000>] (ret_fast_syscall+0x0/0x54)
[    7.338836] Exception stack(0xee7ebfa8 to 0xee7ebff0)
[    7.344116] bfa0:                   b6d797d4 00051f80 00000006 b6d789f8 00000000 b6d7931c
[    7.352661] bfc0: b6d797d4 00051f80 1a3b3500 0000017b 00020000 00037f78 00050048 00065fc8
[    7.361206] bfe0: be856ee0 be856ed0 b6d72c4b b6e7da42
[    7.366485] Code: e3520000 e5e32001 1afffffb e12fff1e (e4d03001) 
[    7.402587] omap3isp 480bc000.isp: Entity type for entity OMAP3 ISP preview was not initialized!
[    7.440429] omap3isp 480bc000.isp: Entity type for entity OMAP3 ISP resizer was not initialized!
[    7.486389] omap3isp 480bc000.isp: Entity type for entity OMAP3 ISP AEWB was not initialized!
[    7.495300] omap3isp 480bc000.isp: Entity type for entity OMAP3 ISP AF was not initialized!
[    7.596343] omap3isp 480bc000.isp: Entity type for entity OMAP3 ISP histogram was not initialized!
[    7.605743] ov9655 1-0030: __ov9655_set_power on=1
[    7.776428] ov9655 1-0030: OV9655 read register 1c : ffffff87
[    7.796295] ov9655 1-0030: OV9655 read register 1d : ffffff87
[    7.802307] ov9655 1-0030: OV9655 not detected, can't read manufacturer id

The message

[    6.684143] pwm_backlight_probe 4 err=-517

comes from:


	pb->pwm = devm_pwm_get(&pdev->dev, NULL);
	if (IS_ERR(pb->pwm) && PTR_ERR(pb->pwm) != -EPROBE_DEFER && !node) {
		dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
		pb->legacy = true;
		pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
	}

	if (IS_ERR(pb->pwm)) {
		ret = PTR_ERR(pb->pwm);
		if (ret != -EPROBE_DEFER)
			dev_err(&pdev->dev, "unable to request PWM\n");
printk("%s 4 err=%d\n", __func__, ret);
		goto err_alloc;
	}

...

err_alloc:
	if (data->exit)
		data->exit(&pdev->dev);
printk("%s err=%d\n", __func__, ret);
	return ret;
}

It shows that the problem is probably NOT in the pwm_bl driver, but in
devm_pwm_get(). I have no idea when this does defer probing and if all
error paths are correct.

The device tree looks like:

http://git.goldelico.com/?p=gta04-kernel.git;a=blob;f=arch/arm/boot/dts/omap3-gta04.dtsi;h=df49abe678109a718e7669f198c88bf3578376e3;hb=refs/heads/letux-4.17-rc5#l124

Do you have recommendations how to debug and whom to contact?

BR and thanks,
Nikolaus



More information about the Letux-kernel mailing list