From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Johan Hovold <johan@kernel.org>,
Daniel Thompson <daniel.thompson@linaro.org>,
Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 3.18 74/85] backlight: as3711_bl: Fix Device Tree node lookup
Date: Sun, 1 Jul 2018 18:02:32 +0200 [thread overview]
Message-ID: <20180701153125.317947154@linuxfoundation.org> (raw)
In-Reply-To: <20180701153122.365061142@linuxfoundation.org>
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <johan@kernel.org>
commit 4a9c8bb2aca5b5a2a15744333729745dd9903562 upstream.
Fix child-node lookup during probe, which ended up searching the whole
device tree depth-first starting at the parent rather than just matching
on its children.
To make things worse, the parent mfd node was also prematurely freed.
Cc: stable <stable@vger.kernel.org> # 3.10
Fixes: 59eb2b5e57ea ("drivers/video/backlight/as3711_bl.c: add OF support")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/video/backlight/as3711_bl.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
--- a/drivers/video/backlight/as3711_bl.c
+++ b/drivers/video/backlight/as3711_bl.c
@@ -262,10 +262,10 @@ static int as3711_bl_register(struct pla
static int as3711_backlight_parse_dt(struct device *dev)
{
struct as3711_bl_pdata *pdata = dev_get_platdata(dev);
- struct device_node *bl =
- of_find_node_by_name(dev->parent->of_node, "backlight"), *fb;
+ struct device_node *bl, *fb;
int ret;
+ bl = of_get_child_by_name(dev->parent->of_node, "backlight");
if (!bl) {
dev_dbg(dev, "backlight node not found\n");
return -ENODEV;
@@ -279,7 +279,7 @@ static int as3711_backlight_parse_dt(str
if (pdata->su1_max_uA <= 0)
ret = -EINVAL;
if (ret < 0)
- return ret;
+ goto err_put_bl;
}
fb = of_parse_phandle(bl, "su2-dev", 0);
@@ -292,7 +292,7 @@ static int as3711_backlight_parse_dt(str
if (pdata->su2_max_uA <= 0)
ret = -EINVAL;
if (ret < 0)
- return ret;
+ goto err_put_bl;
if (of_find_property(bl, "su2-feedback-voltage", NULL)) {
pdata->su2_feedback = AS3711_SU2_VOLTAGE;
@@ -314,8 +314,10 @@ static int as3711_backlight_parse_dt(str
pdata->su2_feedback = AS3711_SU2_CURR_AUTO;
count++;
}
- if (count != 1)
- return -EINVAL;
+ if (count != 1) {
+ ret = -EINVAL;
+ goto err_put_bl;
+ }
count = 0;
if (of_find_property(bl, "su2-fbprot-lx-sd4", NULL)) {
@@ -334,8 +336,10 @@ static int as3711_backlight_parse_dt(str
pdata->su2_fbprot = AS3711_SU2_GPIO4;
count++;
}
- if (count != 1)
- return -EINVAL;
+ if (count != 1) {
+ ret = -EINVAL;
+ goto err_put_bl;
+ }
count = 0;
if (of_find_property(bl, "su2-auto-curr1", NULL)) {
@@ -355,11 +359,20 @@ static int as3711_backlight_parse_dt(str
* At least one su2-auto-curr* must be specified iff
* AS3711_SU2_CURR_AUTO is used
*/
- if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO))
- return -EINVAL;
+ if (!count ^ (pdata->su2_feedback != AS3711_SU2_CURR_AUTO)) {
+ ret = -EINVAL;
+ goto err_put_bl;
+ }
}
+ of_node_put(bl);
+
return 0;
+
+err_put_bl:
+ of_node_put(bl);
+
+ return ret;
}
static int as3711_backlight_probe(struct platform_device *pdev)
next prev parent reply other threads:[~2018-07-01 16:14 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-01 16:01 [PATCH 3.18 00/85] 3.18.114-stable review Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 01/85] tools build: No need to make libapi for perf explicitly Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 02/85] tools build: Fix Makefile(s) to properly invoke tools build Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 03/85] af_key: Always verify length of provided sadb_key Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 04/85] fsnotify: fix ignore mask logic in send_to_group() Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 05/85] MIPS: io: Add barrier after register read in readX() Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 06/85] s390/smsgiucv: disable SMSG on module unload Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 07/85] isofs: fix potential memory leak in mount option parsing Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 08/85] scsi: iscsi: respond to netlink with unicast when appropriate Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 09/85] drm/msm: Fix possible null dereference on failure of get_pages() Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 10/85] parisc: time: Convert read_persistent_clock() to read_persistent_clock64() Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 11/85] scsi: isci: Fix infinite loop in while loop Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 12/85] net: phy: marvell: clear wol event before setting it Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 13/85] arm64: ptrace: remove addr_limit manipulation Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 14/85] selftests: ftrace: Add a testcase for multiple actions on trigger Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 16/85] x86/cpu/intel: Add missing TLB cpuid values Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 18/85] ARM: davinci: board-dm355-evm: fix broken networking Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 19/85] hexagon: add memset_io() helper Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 20/85] hexagon: export csum_partial_copy_nocheck Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 21/85] scsi: vmw-pvscsi: return DID_BUS_BUSY for adapter-initated aborts Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 22/85] parisc: drivers.c: Fix section mismatches Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 23/85] kthread, sched/wait: Fix kthread_parkme() wait-loop Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 24/85] mac80211: Adjust SAE authentication timeout Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 25/85] drm/omap: fix possible NULL ref issue in tiler_reserve_2d Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 27/85] can: dev: increase bus-off message severity Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 30/85] ARM: keystone: fix platform_domain_notifier array overrun Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 31/85] i2c: pmcmsp: return message count on master_xfer success Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 32/85] i2c: pmcmsp: fix error return from master_xfer Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 33/85] i2c: viperboard: return message count on master_xfer success Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 34/85] ARM: davinci: board-dm646x-evm: set VPIF capture card name Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 35/85] parisc: Move setup_profiling_timer() out of init section Greg Kroah-Hartman
2018-07-01 16:29 ` Helge Deller
2018-07-03 9:17 ` Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 37/85] tcp: do not overshoot window_clamp in tcp_rcv_space_adjust() Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 38/85] ext4: update mtime in ext4_punch_hole even if no blocks are released Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 39/85] ext4: fix fencepost error in check for inode count overflow during resize Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 40/85] btrfs: scrub: Dont use inode pages for device replace Greg Kroah-Hartman
2018-07-01 16:01 ` [PATCH 3.18 41/85] ALSA: hda - Handle kzalloc() failure in snd_hda_attach_pcm_stream() Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 42/85] libata: zpodd: make arrays cdb static, reduces object code size Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 43/85] libata: zpodd: small read overflow in eject_tray() Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 44/85] libata: Drop SanDisk SD7UB3Q*G1001 NOLPM quirk Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 45/85] w1: mxc_w1: Enable clock before calling clk_get_rate() on it Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 46/85] fs/binfmt_misc.c: do not allow offset overflow Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 47/85] m68k/mm: Adjust VM area to be unmapped by gap size for __iounmap() Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 48/85] signal/xtensa: Consistenly use SIGBUS in do_unaligned_user Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 49/85] usb: do not reset if a low-speed or full-speed device timed out Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 50/85] ASoC: dapm: delete dapm_kcontrol_data paths list before freeing it Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 51/85] ASoC: cirrus: i2s: Fix LRCLK configuration Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 53/85] mips: ftrace: fix static function graph tracing Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 54/85] branch-check: fix long->int truncation when profiling branches Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 55/85] ipmi:bt: Set the timeout before doing a capabilities check Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 56/85] fuse: atomic_o_trunc should truncate pagecache Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 57/85] fuse: dont keep dead fuse_conn at fuse_fill_super() Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 58/85] powerpc/mm/hash: Add missing isync prior to kernel stack SLB switch Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 59/85] powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 60/85] powerpc/ptrace: Fix enforcement of DAWR constraints Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 61/85] powerpc/fadump: Unregister fadump on kexec down path Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 62/85] ARM: 8764/1: kgdb: fix NUMREGBYTES so that gdb_regs[] is the correct size Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 63/85] mtd: cfi_cmdset_0002: Change write buffer to check correct value Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 64/85] mtd: cfi_cmdset_0002: Use right chip in do_ppb_xxlock() Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 65/85] mtd: cfi_cmdset_0002: fix SEGV unlocking multiple chips Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 66/85] mtd: cfi_cmdset_0002: Fix unlocking requests crossing a chip boudary Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 67/85] mtd: cfi_cmdset_0002: Avoid walking all chips when unlocking Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 69/85] PCI: pciehp: Clear Presence Detect and Data Link Layer Status Changed on resume Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 70/85] MIPS: io: Add barrier after register read in inX() Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 72/85] scsi: qla2xxx: Fix setting lower transfer speed if GPSC fails Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 73/85] UBIFS: Fix potential integer overflow in allocation Greg Kroah-Hartman
2018-07-01 16:02 ` Greg Kroah-Hartman [this message]
2018-07-01 16:02 ` [PATCH 3.18 75/85] backlight: max8925_bl: Fix Device Tree node lookup Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 76/85] backlight: tps65217_bl: " Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 77/85] media: v4l2-compat-ioctl32: prevent go past max size Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 78/85] media: cx231xx: Add support for AverMedia DVD EZMaker 7 Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 79/85] media: dvb_frontend: fix locking issues at dvb_frontend_get_event() Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 80/85] nfsd: restrict rd_maxcount to svc_max_payload in nfsd_encode_readdir Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 81/85] video: uvesafb: Fix integer overflow in allocation Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 82/85] xen: Remove unnecessary BUG_ON from __unbind_from_irq() Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 83/85] udf: Detect incorrect directory size Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 84/85] block: Fix transfer when chunk sectors exceeds max Greg Kroah-Hartman
2018-07-01 16:02 ` [PATCH 3.18 85/85] dm thin: handle running out of data space vs concurrent discard Greg Kroah-Hartman
2018-07-01 19:37 ` [PATCH 3.18 00/85] 3.18.114-stable review Nathan Chancellor
2018-07-02 6:34 ` Greg Kroah-Hartman
2018-07-02 7:51 ` Harsh 'MSF Jarvis' Shandilya
2018-07-02 8:35 ` Greg Kroah-Hartman
2018-07-02 16:31 ` 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=20180701153125.317947154@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=daniel.thompson@linaro.org \
--cc=johan@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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).