linux/drivers
Grant Likely ad2fee661f drivercore: Fix unregistration path of platform devices
commit 7f5dcaf1fd upstream.

The unregister path of platform_device is broken. On registration, it
will register all resources with either a parent already set, or
type==IORESOURCE_{IO,MEM}. However, on unregister it will release
everything with type==IORESOURCE_{IO,MEM}, but ignore the others. There
are also cases where resources don't get registered in the first place,
like with devices created by of_platform_populate()*.

Fix the unregister path to be symmetrical with the register path by
checking the parent pointer instead of the type field to decide which
resources to unregister. This is safe because the upshot of the
registration path algorithm is that registered resources have a parent
pointer, and non-registered resources do not.

* It can be argued that of_platform_populate() should be registering
  it's resources, and they argument has some merit. However, there are
  quite a few platforms that end up broken if we try to do that due to
  overlapping resources in the device tree. Until that is fixed, we need
  to solve the immediate problem.

Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2015-09-21 10:05:44 -07:00
..
accessibility printk: move braille console support into separate braille.[ch] files 2013-07-31 14:41:03 -07:00
acpi ACPI, PCI: Penalize legacy IRQ used by ACPI SCI 2015-09-21 10:05:44 -07:00
amba ARM: 8334/1: amba: tegra-ahb: detect and correct bogus base address 2015-04-02 10:03:55 +01:00
android android: binder: fix binder mmap failures 2015-03-01 18:43:51 -08:00
ata PCI: Disable async suspend/resume for JMicron multi-function SATA/AHCI 2015-09-21 10:05:34 -07:00
atm drivers: atm: nicstar: remove ifdef'd out skb destructors 2015-03-10 13:34:53 -04:00
auxdisplay auxdisplay: ks0108: fix refcount 2015-09-21 10:05:42 -07:00
base drivercore: Fix unregistration path of platform devices 2015-09-21 10:05:44 -07:00
bcma Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-04-17 15:50:54 -04:00
block xen-blkback: replace work_pending with work_busy in purge_persistent_gnt() 2015-09-13 09:07:38 -07:00
bluetooth Bluetooth: btbcm: allow btbcm_read_verbose_config to fail on Apple 2015-08-03 09:28:58 -07:00
bus bus: arm-ccn: Fix node->XP config conversion 2015-08-03 09:29:07 -07:00
cdrom block,scsi: fixup blk_get_request dead queue scenarios 2014-08-28 10:03:46 -06:00
char hwmon: (dell-smm) Blacklist Dell Studio XPS 8100 2015-08-16 20:52:21 -07:00
clk clk: qcom: Fix MSM8916 prng clock enable bit 2015-09-21 10:05:33 -07:00
clocksource clocksource: exynos_mct: Avoid blocking calls in the cpu hotplug notifier 2015-08-03 09:29:16 -07:00
connector kconfig: use bool instead of boolean for type definition attributes 2015-01-07 13:08:04 +01:00
cpufreq intel_pstate: Add get_scaling cpu_defaults param to Knights Landing 2015-08-10 12:21:59 -07:00
cpuidle tick/idle/powerpc: Do not register idle states with CPUIDLE_FLAG_TIMER_STOP set in periodic mode 2015-07-10 09:49:35 -07:00
crypto crypto: vmx - Fixing GHASH Key issue on little endian 2015-09-21 10:05:40 -07:00
dca dca: convert to idr_alloc() 2013-02-27 19:10:15 -08:00
devfreq PM / devfreq: tegra: Register governor on module init 2015-03-31 13:17:15 +09:00
dio m68k: don't export static inline functions 2009-12-06 11:18:28 +01:00
dma dmaengine: at_xdmac: fix transfer data width in at_xdmac_prep_slave_sg() 2015-08-16 20:52:16 -07:00
dma-buf dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
edac EDAC, ppc4xx: Access mci->csrows array elements properly 2015-09-13 09:07:40 -07:00
eisa Revert "EISA: Initialize device before its resources" 2014-01-17 14:57:29 -07:00
extcon extcon: usb-gpio: register extcon device before IRQ registration 2015-04-27 11:06:05 +09:00
firewire Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-03-03 21:16:48 -05:00
firmware efi: Check for NULL efi kernel parameters 2015-08-10 12:21:57 -07:00
fmc Merge 3.14-rc5 into char-misc-next 2014-03-02 19:53:09 -08:00
gpio gpio: rcar: Check for irq_set_irq_wake() failures 2015-07-21 10:10:01 -07:00
gpu drm/i915: Limit the number of loops for reading a split 64bit register 2015-09-21 10:05:27 -07:00
hid HID: cp2112: fix I2C_SMBUS_BYTE write 2015-09-21 10:05:41 -07:00
hsi HSI: cmt_speech: fix error return code 2015-04-05 14:45:27 +02:00
hv Drivers: hv: hv_balloon: correctly handle num_pages>INT_MAX case 2015-04-03 16:20:12 +02:00
hwmon hwmon: (nct7904) Export I2C module alias information 2015-08-16 20:52:21 -07:00
hwspinlock hwspinlock: drop owner assignment from platform_drivers 2014-10-20 16:20:37 +02:00
hwtracing/coresight Char/Misc driver patches for 4.1-rc1 2015-04-21 09:42:58 -07:00
i2c i2c: use parent adapter quirks in mux 2015-08-03 09:29:01 -07:00
ide Merge branch 'for-4.1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2015-05-11 10:54:20 -07:00
idle Power management and ACPI updates for v4.1-rc1 2015-04-14 20:21:54 -07:00
iio iio: adis16480: Fix scale factors 2015-09-21 10:05:28 -07:00
infiniband IB/ipoib: Fix CONFIG_INFINIBAND_IPOIB_CM 2015-08-10 12:21:58 -07:00
input Input: gpio_keys_polled - request GPIO pin as input. 2015-09-13 09:07:49 -07:00
iommu iommu/vt-d: Fix VM domain ID leak 2015-08-10 12:21:55 -07:00
ipack ipoctal: clear break interrupt as soon as it occurs 2014-09-23 23:26:42 -07:00
irqchip irqchip/crossbar: Restore set_wake functionality 2015-09-13 09:07:51 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-04-15 09:00:47 -07:00
leds leds / PM: fix hibernation on arm when gpio-led used with CPU led trigger 2015-07-21 10:10:05 -07:00
lguest lguest: fix out-by-one error in address checking. 2015-05-27 09:57:21 -07:00
macintosh Merge branch 'next-remove-ldst' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc into next 2015-04-07 13:25:14 +10:00
mailbox mailbox: arm_mhu: add driver for ARM MHU controller 2015-03-17 11:12:01 +05:30
mcb mcb: request_mem_region() returns NULL on error 2015-04-03 16:15:30 +02:00
md dm thin metadata: delete btrees when releasing metadata snapshot 2015-09-13 09:07:40 -07:00
media cx24116: fix a buffer overflow when checking userspace params 2015-08-03 09:29:03 -07:00
memory ARM: SoC driver updates for v4.1 2015-04-22 09:18:17 -07:00
memstick memstick: mspro_block: add missing curly braces 2015-04-17 09:04:09 -04:00
message i2o: move to staging 2015-02-03 15:58:39 -08:00
mfd mfd: arizona: Fix initialisation of the PM runtime 2015-09-13 09:07:44 -07:00
misc mei: prevent unloading mei hw modules while the device is opened. 2015-08-10 12:21:57 -07:00
mmc mmc: sdhci-pxav3: fix platform_data is not initialized 2015-08-10 12:21:55 -07:00
mtd mtd: dc21285: use raw spinlock functions for nw_gpio_lock 2015-07-21 10:10:05 -07:00
net can: pcan_usb: don't provide CAN FD bittimings by non-FD adapters 2015-09-13 09:07:51 -07:00
nfc NFC: st21nfcb: remove st21nfcb_nci_i2c_disable 2015-08-03 09:29:01 -07:00
ntb ntb: initialize max_mw for Atom before using it 2015-06-11 09:27:24 -04:00
nubus nubus: Remove superfluous interrupt disable/restore 2014-10-27 11:03:19 +01:00
of of/address: Don't loop forever in of_find_matching_node_by_address(). 2015-09-21 10:05:43 -07:00
oprofile Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
parisc parisc: %pf is only for function pointers 2015-04-24 13:45:54 +02:00
parport parport: parport_atari: Remove obsolete IRQ_TYPE_SLOW 2015-01-15 13:44:50 +01:00
pci PCI: Disable async suspend/resume for JMicron multi-function SATA/AHCI 2015-09-21 10:05:34 -07:00
pcmcia Disable write buffering on Toshiba ToPIC95 2015-07-21 10:10:01 -07:00
phy phy: twl4030-usb: make runtime pm more reliable. 2015-08-16 20:52:13 -07:00
pinctrl Subject: pinctrl: imx1-core: Fix debug output in .pin_config_set callback 2015-08-10 12:21:54 -07:00
platform dell-laptop: Fix allocating & freeing SMI buffer page 2015-08-03 09:29:16 -07:00
pnp ACPI / PNP: Reserve ACPI resources at the fs_initcall_sync stage 2015-08-03 09:29:14 -07:00
power power_supply: Fix possible NULL pointer dereference on early uevent 2015-07-21 10:10:03 -07:00
powercap powercap / RAPL: Add support for Intel Skylake processors 2015-04-15 23:06:16 +02:00
pps pps: clients: drop owner assignment from platform_drivers 2014-10-20 16:21:28 +02:00
ps3 ps3: Fix trivial typos in comment and debug message 2015-03-26 15:23:17 +11:00
ptp ptp: remove 32 bit get/set methods. 2015-03-31 12:01:19 -04:00
pwm pwm: img: Impose upper and lower timebase steps value 2015-05-19 16:07:40 +02:00
rapidio Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-02-18 08:49:20 -08:00
ras trace, RAS: Add eMCA trace event interface 2014-06-25 13:26:47 -07:00
regulator regulator: pbias: Fix broken pbias disable functionality 2015-09-21 10:05:43 -07:00
remoteproc remoteproc: add IOMMU hardware capability flag 2015-03-12 10:43:26 +02:00
reset reset: sunxi: fix spinlock initialization 2015-01-16 19:11:31 -08:00
rpmsg virtio_rpmsg: set DRIVER_OK before using device 2015-03-13 15:55:42 +10:30
rtc rtc: snvs: fix wakealarm by call enable_irq_wake earlier 2015-08-03 09:29:01 -07:00
s390 s390/sclp: fix compile error 2015-09-21 10:05:27 -07:00
sbus drivers/sbus/char/envctrl.c: ignore orderly_poweroff return value 2015-04-15 16:35:23 -07:00
scsi fnic: Use the local variable instead of I/O flag to acquire io_req_lock in fnic_queuecommand() to avoid deadloack 2015-09-13 09:07:51 -07:00
sfi SFI: fix compiler warnings 2014-12-03 18:49:20 -05:00
sh drivers: sh: Remove test for now unsupported sh7372 2015-04-27 13:08:14 +09:00
sn Drivers: misc: remove __dev* attributes. 2013-01-03 15:57:16 -08:00
soc soc/tegra: pmc: Avoid usage of uninitialized variable 2015-09-21 10:05:43 -07:00
spi spi/spi-xilinx: Fix mixed poll/irq mode 2015-09-21 10:05:42 -07:00
spmi spmi: pmic_arb: remove ARM build time dependency 2015-04-03 16:15:30 +02:00
ssb SSB: Fix handling of ssb_pmu_get_alp_clock() 2015-06-09 16:38:06 +02:00
staging staging: comedi: usbduxsigma: don't clobber ao_timer in command test 2015-09-21 10:05:30 -07:00
target target/iscsi: Fix double free of a TUR followed by a solicited NOPOUT 2015-09-13 09:07:48 -07:00
tc TC: Error handling clean-ups 2014-11-24 07:45:25 +01:00
thermal thermal: exynos: Disable the regulator on probe failure 2015-08-16 20:52:25 -07:00
thunderbolt thunderbolt: Clear hops before overwriting 2014-08-26 14:54:48 -07:00
tty serial: samsung: fix DMA for FIFO smaller than cache line size 2015-09-21 10:05:40 -07:00
uio Revert "uio: constify of_device_id array" 2015-04-03 16:04:21 +02:00
usb usb: host: ehci-sys: delete useless bus_to_hcd conversion 2015-09-21 10:05:38 -07:00
uwb uwb: Remove umc bus legacy suspend/resume support 2015-03-18 17:27:03 +01:00
vfio vfio: Fix runaway interruptible timeout 2015-05-01 16:31:41 -06:00
vhost vhost: actually track log eventfd file 2015-08-10 12:21:58 -07:00
video video: mxsfb: Make sure axi clock is enabled when accessing registers 2015-07-21 10:10:05 -07:00
virt drivers: clean-up prom.h implicit includes 2013-10-09 20:04:04 -05:00
virtio virtio_pci: Clear stale cpumask when setting irq affinity 2015-06-04 14:47:49 +02:00
vlynq drivers/vlynq/vlynq.c: fix another resource size off by 1 error 2014-01-23 16:36:55 -08:00
vme vme: tsi148: Master windows support USERx and CR/CSR accesses, not slaves 2015-03-06 17:03:22 -08:00
w1 w1_therm reference count family data 2015-08-03 09:29:11 -07:00
watchdog watchdog: omap: assert the counter being stopped before reprogramming 2015-08-03 09:29:16 -07:00
xen xen/xenbus: Don't leak memory when unmapping the ring on HVM backend 2015-09-13 09:07:40 -07:00
zorro zorro: drop owner assignment from platform_drivers 2014-10-20 16:21:57 +02:00
Kconfig i2o: move to staging 2015-02-03 15:58:39 -08:00
Makefile coresight: moving to new "hwtracing" directory 2015-04-03 16:17:04 +02:00