[alsa-devel] BUG of new AC97 bus layer
Lihua Yao
ylhuajnu at 163.com
Sun Aug 12 15:40:08 CEST 2018
Hi Robert;
I am playing with AC97+WM9714 of TINY6410 board. I had made it to retrieve
WM8914's vendor id but a BUG at probing WM97xx MFD device.
After digging, I thought the offending code is 'structure assignment' at line 74.
Both ac97->dev and adev->dev are objects of type 'struct device' rather than
'struct device *'.
65 struct snd_ac97 *snd_ac97_compat_alloc(struct ac97_codec_device *adev)
66 {
67 struct snd_ac97 *ac97;
68
69 ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL);
70 if (ac97 == NULL)
71 return ERR_PTR(-ENOMEM);
72
73 printk("%s: %s %px\n", __func__, dev_name(&adev->dev), &adev->dev);
74 ac97->dev = adev->dev;
75
Below is a quick hack I came up with.
diff --git a/sound/ac97/snd_ac97_compat.c b/sound/ac97/snd_ac97_compat.c
index 61544e0d8de4..1ba2e7f48b41 100644
--- a/sound/ac97/snd_ac97_compat.c
+++ b/sound/ac97/snd_ac97_compat.c
@@ -70,7 +70,9 @@ struct snd_ac97 *snd_ac97_compat_alloc(struct
ac97_codec_device *adev)
if (ac97 == NULL)
return ERR_PTR(-ENOMEM);
- ac97->dev = adev->dev;
+ device_initialize(&ac97->dev);
+ dev_set_name(&ac97->dev, "%s-compat", dev_name(&adev->dev));
+
ac97->private_data = adev;
ac97->bus = &compat_soc_ac97_bus;
return ac97;
[ 2.657160] ac97_bus_scan: 574d4c13
[ 2.661390] ac97_bus_probe: 7f001000.ac97:0
[ 2.665256] snd_ac97_compat_alloc: 7f001000.ac97:0 cf0d3000
[ 2.670349] wm97xx-core 7f001000.ac97:0: wm97xx core found, id=0x574d4c13
[ 2.677338] __devm_regmap_init_ac97: 7f001000.ac97:0 cf2c4dd0
[ 2.682838] __devm_regmap_init: 7f001000.ac97:0 cf2c4dd0
[ 2.688795] list_add corruption. prev->next should be next (cf2c4f60), but
was cf0d3190. (prev=cf20b480).
[ 2.697775] ------------[ cut here ]------------
[ 2.702262] kernel BUG at
/workspace/tiny6410/kernel/linux-stable/lib/list_debug.c:28!
[ 2.710156] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
[ 2.715622] Modules linked in:
[ 2.718667] CPU: 0 PID: 1 Comm: swapper Not tainted 4.18.0-rc8 #100
[ 2.724904] Hardware name: Samsung S3C64xx (Flattened Device Tree)
[ 2.731093] PC is at __list_add_valid+0x68/0x78
[ 2.735588] LR is at __list_add_valid+0x68/0x78
[ 2.740089] pc : [<c02ec4ac>] lr : [<c02ec4ac>] psr: 20000093
[ 2.746336] sp : cf887c18 ip : 60000093 fp : 00000000
[ 2.751541] r10: 00000000 r9 : cf2c4dd0 r8 : cf2b5e00
[ 2.756750] r7 : cf2c4f60 r6 : cf20b480 r5 : cf2c4dd0 r4 : cf1250c0
[ 2.763255] r3 : 00000001 r2 : cf886000 r1 : cf886004 r0 : 0000005d
[ 2.769766] Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment none
[ 2.776966] Control: 00c5387d Table: 50004008 DAC: 00000051
[ 2.782693] Process swapper (pid: 1, stack limit = 0x(ptrval))
[ 2.788505] Stack: (0xcf887c18 to 0xcf888000)
[ 2.792848] 7c00: cf1250c0 c034dbf8
[ 2.801013] 7c20: a0000013 cf1250c0 a0000013 cf2c4f50 cf2c4dd0 a0000013
cf1250d0 c034e318
[ 2.809168] 7c40: cf2b5e00 cf2c4dd0 00000000 cf2c4c00 cf2b5e00 c03629e4
0000002f cf2b5e00
[ 2.817324] 7c60: c05d2ba8 c03634f4 00000000 00000000 00000000 c005b968
cf2b5e9c cf2b5e94
[ 2.825481] 7c80: c05d13c8 cf2c4dd0 cf125730 cf2c4c00 c05d13c8 c05d2ba8
00000000 00000000
[ 2.833637] 7ca0: 00000000 c03637fc 00000000 00000000 cf2c4c00 cf2c4dd0
00000000 c05d2ba8
[ 2.841793] 7cc0: 00000000 c03692b4 00000000 00000000 cf20b490 c0838700
cf20b49c c08aa1dc
[ 2.849947] 7ce0: c083859c c036e8a4 00000001 00000001 00000000 c0581218
cf0d3000 c083859c
[ 2.858105] 7d00: cf0d3104 c0428668 cf0d3000 00000000 c08aa1d4 c034ac64
cf0d3190 00000000
[ 2.866261] 7d20: cf887d58 c034ae18 00000000 00000000 cf15c010 00000000
c08aa1b0 c03491b0
[ 2.874418] 7d40: cf9e4a90 cf081ac4 cf0d3000 cf0d3034 00000001 c034a96c
cf0d3000 00000001
[ 2.882574] 7d60: cf0d3000 cf0d3000 cf0d3000 c0840e40 00000000 c0349e80
cf0d3000 cf0d3008
[ 2.890729] 7d80: c07db048 c0348304 cf0d3008 cf15c000 cf125fc0 c0840e40
cf15c1e0 cf260a16
[ 2.898886] 7da0: cf15c000 cf15c000 cf15c000 00000000 c0840e40 cf15c1e0
c072d458 cf15c010
[ 2.907042] 7dc0: 000001d4 c0428b00 006000c0 cf91eb90 cf91ea10 c042882c
574d4c13 cf0d3000
[ 2.915198] 7de0: c08594c0 cf15c004 c05e6318 cf15ee10 cf91ea10 cf91ea00
00000000 00000000
[ 2.923354] 7e00: 00000000 cf15ee88 c08594c0 c0427a1c 00000000 cf9140a0
cf15ee10 00000000
[ 2.931510] 7e20: 00000000 cf91ea10 00000000 c0840a34 c0840a20 c0840a34
00000000 c034c8bc
[ 2.939667] 7e40: c034c870 cf91ea10 00000000 c08aa1d4 c08aa1dc c034ac64
cf91eba0 00000000
[ 2.947822] 7e60: cf91ea10 c0840a34 cf91ea44 00000000 00000000 c07cc864
c0711df4 c034ade4
[ 2.955979] 7e80: c0840a34 c034acfc cf91ea10 c0349244 cf83ce70 cf8fa5e0
c0840a34 cf206360
[ 2.964133] 7ea0: c0837090 c034a0d4 c070505c c0840a34 00000006 c0840a34
00000006 c07db048
[ 2.972290] 7ec0: c0850ac0 c034b96c c034c20c c07c1e78 00000006 c000aa88
00000001 00000001
[ 2.980444] 7ee0: 00000000 00000000 00000000 00000000 c07e3d50 00000000
00000000 00000000
[ 2.988602] 7f00: cfffcda7 00000000 0000009f 0000009f cfffcdae c003bbcc
c07600a0 00000000
[ 2.996757] 7f20: 00000006 00000006 cfffcdaa cfffcda7 00000000 c07cc838
00000006 cf260a16
[ 3.004915] 7f40: c07cc83c 00000006 c07d5744 c0850aec 00000000 c0790fec
00000006 00000006
[ 3.013069] 7f60: 00000000 c07905e0 00000000 0000009f 00000000 00000000
00000000 00000000
[ 3.021225] 7f80: 00000000 00000000 c057ae78 00000000 00000000 00000000
00000000 00000000
[ 3.029381] 7fa0: 00000000 c057ae80 00000000 c00090e8 00000000 00000000
00000000 00000000
[ 3.037536] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000
[ 3.045693] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
00000000 00000000
[ 3.053880] [<c02ec4ac>] (__list_add_valid) from [<c034dbf8>] (add_dr+0x38/0x58)
[ 3.061232] [<c034dbf8>] (add_dr) from [<c034e318>] (devres_add+0x28/0x38)
[ 3.068095] [<c034e318>] (devres_add) from [<c03629e4>]
(regmap_attach_dev+0x44/0x64)
[ 3.075900] [<c03629e4>] (regmap_attach_dev) from [<c03634f4>]
(__regmap_init+0xa10/0xc94)
[ 3.084139] [<c03634f4>] (__regmap_init) from [<c03637fc>]
(__devm_regmap_init+0x84/0xc0)
[ 3.092302] [<c03637fc>] (__devm_regmap_init) from [<c03692b4>]
(__devm_regmap_init_ac97+0x54/0x68)
[ 3.101325] [<c03692b4>] (__devm_regmap_init_ac97) from [<c036e8a4>]
(wm97xx_ac97_probe+0xe0/0x170)
[ 3.110351] [<c036e8a4>] (wm97xx_ac97_probe) from [<c0428668>]
(ac97_bus_probe+0x8c/0x128)
[ 3.118598] [<c0428668>] (ac97_bus_probe) from [<c034ac64>]
(driver_probe_device+0x270/0x308)
[ 3.127093] [<c034ac64>] (driver_probe_device) from [<c03491b0>]
(bus_for_each_drv+0x5c/0x88)
[ 3.135594] [<c03491b0>] (bus_for_each_drv) from [<c034a96c>]
(__device_attach+0x9c/0xfc)
[ 3.143748] [<c034a96c>] (__device_attach) from [<c0349e80>]
(bus_probe_device+0x84/0x8c)
[ 3.151904] [<c0349e80>] (bus_probe_device) from [<c0348304>]
(device_add+0x32c/0x558)
[ 3.159803] [<c0348304>] (device_add) from [<c0428b00>]
(snd_ac97_controller_register+0x228/0x2a8)
[ 3.168740] [<c0428b00>] (snd_ac97_controller_register) from [<c0427a1c>]
(samsung_ac97_probe+0x19c/0x288)
[ 3.178366] [<c0427a1c>] (samsung_ac97_probe) from [<c034c8bc>]
(platform_drv_probe+0x4c/0x9c)
[ 3.186959] [<c034c8bc>] (platform_drv_probe) from [<c034ac64>]
(driver_probe_device+0x270/0x308)
[ 3.195811] [<c034ac64>] (driver_probe_device) from [<c034ade4>]
(__driver_attach+0xe8/0xec)
[ 3.204224] [<c034ade4>] (__driver_attach) from [<c0349244>]
(bus_for_each_dev+0x68/0x7c)
[ 3.212380] [<c0349244>] (bus_for_each_dev) from [<c034a0d4>]
(bus_add_driver+0x164/0x1f4)
[ 3.220626] [<c034a0d4>] (bus_add_driver) from [<c034b96c>]
(driver_register+0x7c/0x110)
[ 3.228697] [<c034b96c>] (driver_register) from [<c000aa88>]
(do_one_initcall+0x54/0x254)
[ 3.236866] [<c000aa88>] (do_one_initcall) from [<c0790fec>]
(kernel_init_freeable+0x260/0x340)
[ 3.245540] [<c0790fec>] (kernel_init_freeable) from [<c057ae80>]
(kernel_init+0x8/0xf0)
[ 3.253598] [<c057ae80>] (kernel_init) from [<c00090e8>]
(ret_from_fork+0x14/0x2c)
[ 3.261125] Exception stack(0xcf887fb0 to 0xcf887ff8)
[ 3.266164] 7fa0: 00000000 00000000
00000000 00000000
[ 3.274324] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000
[ 3.282477] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 3.289079] Code: e1a01003 e59f0010 e1a0300c ebf5be50 (e7f001f2)
[ 3.295163] ---[ end trace e28d0ebaa150deac ]---
Best Regard
Lihua
More information about the Alsa-devel
mailing list