linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Liam Breck <kernel@networkimprov.net>,
	Mark Greer <mgreer@animalcreek.com>,
	Tony Lindgren <tony@atomide.com>,
	Sebastian Reichel <sre@kernel.org>
Subject: [PATCH 4.9 016/103] power: supply: bq24190_charger: Install irq_handler_thread() at end of probe()
Date: Thu, 11 May 2017 16:11:45 +0200	[thread overview]
Message-ID: <20170511141212.074090692@linuxfoundation.org> (raw)
In-Reply-To: <20170511141210.778405364@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Liam Breck <liam@networkimprov.net>

commit d62acc5ef0621463446091ebd7a345e06e9ab80c upstream.

The device specific data is not fully initialized on
request_threaded_irq(). This may cause a crash when the IRQ handler
tries to reference them.

Fix the issue by installing IRQ handler at the end of the probe.

Fixes: d7bf353fd0aa3 ("bq24190_charger: Add support for TI BQ24190 Battery Charger")
Signed-off-by: Liam Breck <kernel@networkimprov.net>
Acked-by: Mark Greer <mgreer@animalcreek.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/power/supply/bq24190_charger.c |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

--- a/drivers/power/supply/bq24190_charger.c
+++ b/drivers/power/supply/bq24190_charger.c
@@ -1392,22 +1392,13 @@ static int bq24190_probe(struct i2c_clie
 		return -EINVAL;
 	}
 
-	ret = devm_request_threaded_irq(dev, bdi->irq, NULL,
-			bq24190_irq_handler_thread,
-			IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-			"bq24190-charger", bdi);
-	if (ret < 0) {
-		dev_err(dev, "Can't set up irq handler\n");
-		goto out1;
-	}
-
 	pm_runtime_enable(dev);
 	pm_runtime_resume(dev);
 
 	ret = bq24190_hw_init(bdi);
 	if (ret < 0) {
 		dev_err(dev, "Hardware init failed\n");
-		goto out2;
+		goto out1;
 	}
 
 	charger_cfg.drv_data = bdi;
@@ -1418,7 +1409,7 @@ static int bq24190_probe(struct i2c_clie
 	if (IS_ERR(bdi->charger)) {
 		dev_err(dev, "Can't register charger\n");
 		ret = PTR_ERR(bdi->charger);
-		goto out2;
+		goto out1;
 	}
 
 	battery_cfg.drv_data = bdi;
@@ -1427,24 +1418,34 @@ static int bq24190_probe(struct i2c_clie
 	if (IS_ERR(bdi->battery)) {
 		dev_err(dev, "Can't register battery\n");
 		ret = PTR_ERR(bdi->battery);
-		goto out3;
+		goto out2;
 	}
 
 	ret = bq24190_sysfs_create_group(bdi);
 	if (ret) {
 		dev_err(dev, "Can't create sysfs entries\n");
+		goto out3;
+	}
+
+	ret = devm_request_threaded_irq(dev, bdi->irq, NULL,
+			bq24190_irq_handler_thread,
+			IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+			"bq24190-charger", bdi);
+	if (ret < 0) {
+		dev_err(dev, "Can't set up irq handler\n");
 		goto out4;
 	}
 
 	return 0;
 
 out4:
-	power_supply_unregister(bdi->battery);
+	bq24190_sysfs_remove_group(bdi);
 out3:
-	power_supply_unregister(bdi->charger);
+	power_supply_unregister(bdi->battery);
 out2:
-	pm_runtime_disable(dev);
+	power_supply_unregister(bdi->charger);
 out1:
+	pm_runtime_disable(dev);
 	if (bdi->gpio_int)
 		gpio_free(bdi->gpio_int);
 

  parent reply	other threads:[~2017-05-11 15:16 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 14:11 [PATCH 4.9 000/103] 4.9.28-stable review Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 001/103] 9p: fix a potential acl leak Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 002/103] drm/sti: fix GDP size to support up to UHD resolution Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 003/103] hwmon: (it87) Fix pwm4 detection for IT8620 and IT8628 Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 004/103] tpm: fix RC value check in tpm2_seal_trusted Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 005/103] tmp: use pdev for parent device in tpm_chip_alloc Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 008/103] cpupower: Fix turbo frequency reporting for pre-Sandy Bridge cores Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 009/103] powerpc/mm: Fixup wrong LPCR_VRMASD value Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 010/103] powerpc/powernv: Fix opal_exit tracepoint opcode Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 011/103] powerpc/ftrace: Fix confusing help text for DISABLE_MPROFILE_KERNEL Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 012/103] powerpc: Correctly disable latent entropy GCC plugin on prom_init.o Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 013/103] perf/x86/intel/pt: Add format strings for PTWRITE and power event tracing Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 014/103] power: supply: bq24190_charger: Fix irq trigger to IRQF_TRIGGER_FALLING Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 015/103] power: supply: bq24190_charger: Call set_mode_host() on pm_resume() Greg Kroah-Hartman
2017-05-11 14:11 ` Greg Kroah-Hartman [this message]
2017-05-11 14:11 ` [PATCH 4.9 017/103] power: supply: bq24190_charger: Call power_supply_changed() for relevant component Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 018/103] power: supply: bq24190_charger: Dont read fault register outside irq_handle_thread() Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 019/103] power: supply: bq24190_charger: Handle fault before status on interrupt Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 020/103] arm64: dts: r8a7795: Mark EthernetAVB device node disabled Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 021/103] arm: dts: qcom: Fix ipq board clock rates Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 022/103] arm64: Improve detection of user/non-user mappings in set_pte(_at) Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 023/103] leds: ktd2692: avoid harmless maybe-uninitialized warning Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 024/103] ARM: dts: NSP: GPIO reboot open-source Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 025/103] ARM: OMAP5 / DRA7: Fix HYP mode boot for thumb2 build Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 026/103] ARM: dts: sun7i: lamobo-r1: Fix CPU port RGMII settings Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 027/103] mwifiex: debugfs: Fix (sometimes) off-by-1 SSID print Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 028/103] mwifiex: remove redundant dma padding in AMSDU Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 029/103] mwifiex: Avoid skipping WEP key deletion for AP Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 031/103] iwlwifi: mvm: dont restart HW if suspend fails with unified image Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 032/103] iwlwifi: mvm: overwrite skb info later Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 033/103] iwlwifi: pcie: dont increment / decrement a bool Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 035/103] iwlwifi: pcie: fix the set of DMA memory mask Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 036/103] iwlwifi: mvm: fix reorder timer re-arming Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 037/103] iwlwifi: mvm: Use aux queue for offchannel frames in dqa Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 038/103] iwlwifi: mvm/pcie: adjust A-MSDU tx_cmd length in PCIe Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 039/103] iwlwifi: mvm: fix pending frame counter calculation Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 040/103] iwlwifi: mvm: fix references to first_agg_queue in DQA mode Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 041/103] iwlwifi: mvm: synchronize firmware DMA paging memory Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 042/103] iwlwifi: mvm: writing zero bytes to debugfs causes a crash Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 043/103] x86/ioapic: Restore IO-APIC irq_chip retrigger callback Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 045/103] x86/mpx: Re-add MPX to selftests Makefile Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 046/103] clk: Make x86/ conditional on CONFIG_COMMON_CLK Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 047/103] kprobes/x86: Fix kernel panic when certain exception-handling addresses are probed Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 048/103] x86/platform/intel-mid: Correct MSI IRQ line for watchdog device Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 052/103] usb: dwc2: host: use msleep() for long delay Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 053/103] usb: host: ehci-exynos: Decrese node refcount on exynos_ehci_get_phy() error paths Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 054/103] usb: host: ohci-exynos: " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 055/103] usb: chipidea: Only read/write OTGSC from one place Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 056/103] usb: chipidea: Handle extcon events properly Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 057/103] USB: serial: keyspan_pda: fix receive sanity checks Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 058/103] USB: serial: digi_acceleport: fix incomplete rx sanity check Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 059/103] USB: serial: ssu100: fix control-message error handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 060/103] USB: serial: io_edgeport: fix epic-descriptor handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 061/103] USB: serial: ti_usb_3410_5052: fix control-message error handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 062/103] USB: serial: ark3116: fix open " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 063/103] USB: serial: ftdi_sio: fix latency-timer " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 064/103] USB: serial: quatech2: fix control-message " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 065/103] USB: serial: mct_u232: fix modem-status " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 066/103] USB: serial: io_edgeport: fix descriptor " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 067/103] USB: serial: sierra: fix bogus alternate-setting assumption Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 068/103] clk: rockchip: add "," to mux_pll_src_apll_dpll_gpll_usb480m_p on rk3036 Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 069/103] phy: qcom-usb-hs: Add depends on EXTCON Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 070/103] serial: 8250_omap: Fix probe and remove for PM runtime Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 071/103] scsi: qla2xxx: Fix crash in qla2xxx_eh_abort on bad ptr Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 072/103] scsi: mac_scsi: Fix MAC_SCSI=m option when SCSI=m Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 073/103] scsi: scsi_dh_emc: return success in clariion_std_inquiry() Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 074/103] scsi: smartpqi: fix time handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 075/103] MIPS: R2-on-R6 MULTU/MADDU/MSUBU emulation bugfix Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 076/103] brcmfmac: Ensure pointer correctly set if skb data location changes Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 077/103] brcmfmac: Make skb header writable before use Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 078/103] staging/lustre/llite: move root_squash from sysfs to debugfs Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 079/103] staging: wlan-ng: add missing byte order conversion Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 080/103] staging: emxx_udc: remove incorrect __init annotations Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 081/103] ALSA: hda - Fix deadlock of controller device lock at unbinding Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 082/103] sparc64: fix fault handling in NGbzero.S and GENbzero.S Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 083/103] macsec: dynamically allocate space for sglist Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 084/103] tcp: do not underestimate skb->truesize in tcp_trim_head() Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 085/103] bpf: enhance verifier to understand stack pointer arithmetic Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 086/103] bpf, arm64: fix jit branch offset related to ldimm64 Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 087/103] tcp: fix wraparound issue in tcp_lp Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 088/103] net: ipv6: Do not duplicate DAD on link up Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 090/103] tcp: do not inherit fastopen_req from parent Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 091/103] ipv4, ipv6: ensure raw socket message is big enough to hold an IP header Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 092/103] rtnetlink: NUL-terminate IFLA_PHYS_PORT_NAME string Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 093/103] ipv6: initialize route null entry in addrconf_init() Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 094/103] ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 095/103] bnxt_en: allocate enough space for ->ntp_fltr_bmap Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 096/103] bpf: dont let ldimm64 leak map addresses on unprivileged Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 097/103] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 098/103] f2fs: sanity check segment count Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 099/103] xen: Revert commits da72ff5bfcb0 and 72a9b186292d Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 100/103] wlcore: Pass win_size taken from ieee80211_sta to FW Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 101/103] wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 103/103] block: get rid of blk_integrity_revalidate() Greg Kroah-Hartman
2017-05-11 21:09 ` [PATCH 4.9 000/103] 4.9.28-stable review Guenter Roeck
2017-05-12  6:20   ` Greg Kroah-Hartman
2017-05-12 15:24 ` Shuah Khan
2017-05-13  2:47 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170511141212.074090692@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=kernel@networkimprov.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgreer@animalcreek.com \
    --cc=sre@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).