Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit fc0528ee authored by Ziqi Chen's avatar Ziqi Chen Committed by Mayank Rana
Browse files

msm: usb_bam: Fix failure of remove by of_platform_depopulate



If device is created by of_platform_populate and removed by
of_platform_depopulate from parent device driver, platform_data
will be released twice and lead to kernel panic.

of_platform_depopulate will free platform_data of each device driver.
Usually we use devm_kzalloc to malloc for platform_data so it can be
released during driver unregister. So if device is removed by
of_platform_depopulate and platform_data is malloced by devm_kzalloc,
platform_data will be freed twice. To fix it, move this data into
struct usb_bam_ctx_type and then store usb_bam_ctx_type into device
driver data. In this way, it can be get in remove function.

The member regs of usb_bam_ctx_type is not necessary. It is only
used for ioremap which already has been done by virt_addr of
struct sps_bam_props.

Without sps_deregister_bam_device, bam child device will not be
created again during defer probe. So deregister in remove function.

Change-Id: Ibae80745be5810d400a1c05566a99efcc2190020
Signed-off-by: default avatarZiqi Chen <ziqic@codeaurora.org>
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent a7bbb875
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment