pinctrl: single: Add allocation failure checking of saved_vals
authorColin Ian King <colin.king@canonical.com>
Wed, 6 Jun 2018 13:43:38 +0000 (14:43 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 18 Jun 2018 05:55:56 +0000 (07:55 +0200)
commit7f57871f39912978e95db920ddbbfb2304a4bfbf
treee3c35483aa91dc6a39f263c6a36ca7056f2721a2
parentbc3322bc166a2905bc91f774d7b22773dc7c063a
pinctrl: single: Add allocation failure checking of saved_vals

Currently saved_vals is being allocated and there is no check for
failed allocation (which is more likely than normal when using
GFP_ATOMIC).  Fix this by checking for a failed allocation and
propagating this error return down the the caller chain.

Detected by CoverityScan, CID#1469841 ("Dereference null return value")
Fixes: 88a1dbdec682 ("pinctrl: pinctrl-single: Add functions to save and restore pinctrl context")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-single.c