gpio: pl061: handle failed allocations
authorNicholas Mc Guire <hofrat@osadl.org>
Sat, 1 Dec 2018 11:57:18 +0000 (12:57 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Feb 2019 09:09:10 +0000 (10:09 +0100)
commit95dd551264fd184467e6df875fddbf9e2b643d1a
treed28545cdd2bd490ba4cfc279831fb6367464b42d
parentb99b873675cbfec5d28a4c7a2132855f7cb1f411
gpio: pl061: handle failed allocations

[ Upstream commit df209c43a0e8258e096fb722dfbdae4f0dd13fde ]

devm_kzalloc(), devm_kstrdup() and devm_kasprintf() all can
fail internal allocation and return NULL. Using any of the assigned
objects without checking is not safe. As this is early in the boot
phase and these allocations really should not fail, any failure here
is probably an indication of a more serious issue so it makes little
sense to try and rollback the previous allocated resources or try to
continue;  but rather the probe function is simply exited with -ENOMEM.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: 684284b64aae ("ARM: integrator: add MMCI device to IM-PD1")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/mach-integrator/impd1.c