Skip to contentSkip to conversation

mmc: core: remove unnecessary (void*) conversions

PATCH yuzhe 2 participants 2 messages Mar 27, 2023

Subsystems (2)
lore
Share & tools
lore

yuzhe

author
#0 lore raw

<p><br /><br /><br />在 2023-03-24, 星期五, 23:47:08 ,Ulf Hansson 写到:</p>

Quoted 60 lines · Marek Szyprowski
Quoted 8 lines · Yu Zhe

Pointer variables of void * type do not require type cast.

---
drivers/mmc/core/debugfs.c | 2 +- drivers/mmc/core/host.c | 2 +- drivers/mmc/core/mmc_test.c | 6 +++---

3 files changed, 5 insertions(+), 5 deletions(-)

...

drivers/mmc/core/host.c EXPORT_SYMBOL(mmc_alloc_host); · line 593

Quoted 10 lines
drivers/mmc/core/host.c +1 -1
index 096093f7be00..76900f67c782 100644
@@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
 
 static void devm_mmc_host_release(struct device *dev, void *res)
 {
- mmc_free_host(*(struct mmc_host **)res);
+ mmc_free_host(res);

The above chunk is wrong and causes following regression on today's Linux next-20230324:

Unable to handle kernel paging request at virtual address 0000000000001020

Mem abort info:
meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
...
[0000000000001020] user address but active_mm is swapper

Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 3 PID: 10 Comm: kworker/u12:0 Not tainted 6.3.0-rc3-next-20230324+
#13452
Hardware name: Khadas VIM3 (DT)
Workqueue: events_unbound async_run_entry_fn
pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : mmc_pwrseq_free+0x1c/0x38
lr : devm_mmc_host_release+0x1c/0x34
...
Call trace:
mmc_pwrseq_free+0x1c/0x38
devm_mmc_host_release+0x1c/0x34
release_nodes+0x5c/0x90
devres_release_all+0x8c/0xdc
device_unbind_cleanup+0x18/0x68
really_probe+0x11c/0x2b4
__driver_probe_device+0x78/0xe0
driver_probe_device+0xd8/0x160
__device_attach_driver+0xb8/0x138
bus_for_each_drv+0x84/0xe0
__device_attach_async_helper+0xb0/0xd4
async_run_entry_fn+0x34/0xe0
process_one_work+0x288/0x5c0
worker_thread+0x74/0x450
kthread+0x124/0x128
ret_from_fork+0x10/0x20
Code: f9000bf3 aa0003f3 f9424c00 b4000080 (f9401000)
---[ end trace 0000000000000000 ]---
Quoted 2 lines

Ulf: do You want me to send a partial revert or will you handle it by dropping this patch?

Thanks for the report, I will simply drop the patch!

Kind regards
Uffe
</pre>

sorry for making this mistake, I will check seriously next time.

#1 lore raw
Quoted 66 lines · yuzhe

<p><br /><br /><br />在 2023-03-24, 星期五, 23:47:08 ,Ulf Hansson 写到:</p>

Quoted 60 lines · Marek Szyprowski
Quoted 8 lines · Yu Zhe

Pointer variables of void * type do not require type cast.

---
drivers/mmc/core/debugfs.c | 2 +- drivers/mmc/core/host.c | 2 +- drivers/mmc/core/mmc_test.c | 6 +++---

3 files changed, 5 insertions(+), 5 deletions(-)

...

drivers/mmc/core/host.c EXPORT_SYMBOL(mmc_alloc_host); · line 593

Quoted 10 lines
drivers/mmc/core/host.c +1 -1
index 096093f7be00..76900f67c782 100644
@@ -590,7 +590,7 @@ EXPORT_SYMBOL(mmc_alloc_host);
 
 static void devm_mmc_host_release(struct device *dev, void *res)
 {
- mmc_free_host(*(struct mmc_host **)res);
+ mmc_free_host(res);

The above chunk is wrong and causes following regression on today's Linux next-20230324:

Unable to handle kernel paging request at virtual address 0000000000001020

Mem abort info:
meson-gx-mmc ffe07000.mmc: allocated mmc-pwrseq
...
[0000000000001020] user address but active_mm is swapper

Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 3 PID: 10 Comm: kworker/u12:0 Not tainted 6.3.0-rc3-next-20230324+
#13452
Hardware name: Khadas VIM3 (DT)
Workqueue: events_unbound async_run_entry_fn
pstate: 00000005 (nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : mmc_pwrseq_free+0x1c/0x38
lr : devm_mmc_host_release+0x1c/0x34
...
Call trace:
mmc_pwrseq_free+0x1c/0x38
devm_mmc_host_release+0x1c/0x34
release_nodes+0x5c/0x90
devres_release_all+0x8c/0xdc
device_unbind_cleanup+0x18/0x68
really_probe+0x11c/0x2b4
__driver_probe_device+0x78/0xe0
driver_probe_device+0xd8/0x160
__device_attach_driver+0xb8/0x138
bus_for_each_drv+0x84/0xe0
__device_attach_async_helper+0xb0/0xd4
async_run_entry_fn+0x34/0xe0
process_one_work+0x288/0x5c0
worker_thread+0x74/0x450
kthread+0x124/0x128
ret_from_fork+0x10/0x20
Code: f9000bf3 aa0003f3 f9424c00 b4000080 (f9401000)
---[ end trace 0000000000000000 ]---
Quoted 2 lines

Ulf: do You want me to send a partial revert or will you handle it by dropping this patch?

Quoted 7 lines

Thanks for the report, I will simply drop the patch!

Kind regards
Uffe
</pre>

sorry for making this mistake, I will check seriously next time.

Np, things go wrong sometimes, even in the simple cases. Feel free to post an updated patch.

Kind regards
Uffe