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:47:06 +0000 (19:47 +0100)
commit389de86c1045966d548f8e8f49e89cf43fd0a9e8
tree1a9b9f7dbf2fdeef2bb0d6172cbb601b1b2cc0d4
parent26e62a22732427bcab70de8bf01655962d111c22
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