regulator: axp20x: check rdev is null before dereferencing it
authorColin Ian King <colin.king@canonical.com>
Sat, 22 Dec 2018 11:31:59 +0000 (11:31 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 9 Jan 2019 15:50:09 +0000 (15:50 +0000)
commit6f3656f3552a3b32c625c93ddafcbe10bf0fea6d
tree9f63040bd161ec5ad04795720c47602f1970af79
parent48f1b4efd67c922eff113f247533cbe175b1491e
regulator: axp20x: check rdev is null before dereferencing it

Currently rdev is dereferenced when assigning desc before rdev is null
checked, hence there is a potential null pointer dereference on rdev.
Fix this by null checking rdev first.

Detected by CoverityScan, CID#1476031 ("Dereference before null check")

Fixes: 77e3e3b165db ("regulator: axp20x: add software based soft_start for AXP209 LDO3")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/axp20x-regulator.c