diff options
| author | Ziqi Chen <ziqic@codeaurora.org> | 2017-08-04 17:37:33 +0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-08-15 22:03:41 -0700 |
| commit | 98a667af9e9eece8af41a916e6ed925fcfbd5671 (patch) | |
| tree | 0de0f32b08998c0e0fad858f1871a3bb5d5cf1d3 /include/linux | |
| parent | a49bb61510b938152025049730fa922c5da950a1 (diff) | |
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: Ziqi Chen <ziqic@codeaurora.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/usb_bam.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/usb_bam.h b/include/linux/usb_bam.h index e65fb12c1410..b5b9edaab783 100644 --- a/include/linux/usb_bam.h +++ b/include/linux/usb_bam.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -191,7 +191,7 @@ struct usb_bam_pipe_connect { }; /** - * struct msm_usb_bam_platform_data: pipe connection information + * struct msm_usb_bam_data: pipe connection information * between USB/HSIC BAM and another BAM. USB/HSIC BAM can be * either src BAM or dst BAM * @usb_bam_num_pipes: max number of pipes to use. @@ -211,7 +211,7 @@ struct usb_bam_pipe_connect { * can work at in bam2bam mode when connected to SS host. * @enable_hsusb_bam_on_boot: Enable HSUSB BAM (non-NDP) on bootup itself */ -struct msm_usb_bam_platform_data { +struct msm_usb_bam_data { u8 max_connections; int usb_bam_num_pipes; phys_addr_t usb_bam_fifo_baseaddr; |
