pinctrl: sx150x: handle failure case of devm_kstrdup
authorNicholas Mc Guire <hofrat@osadl.org>
Sun, 2 Dec 2018 10:04:17 +0000 (11:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:46:02 +0000 (19:46 +0100)
commit114edb495729be76ab7222daa5bc2fe9da094ba7
treefc4c3e49c2d10a599fcef6ddabd74404fa47cb17
parentf138b2306de828231cb2a6b4a5584397a4d4e2ca
pinctrl: sx150x: handle failure case of devm_kstrdup

[ Upstream commit a9d9f6b83f1bb05da849b3540e6d1f70ef1c2343 ]

devm_kstrdup() may return NULL if internal allocation failed.
Thus using  label, name  is unsafe without checking. Therefor
in the unlikely case of allocation failure, sx150x_probe() simply
returns -ENOMEM.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: 9e80f9064e73 ("pinctrl: Add SX150X GPIO Extender Pinctrl Driver")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/pinctrl-sx150x.c