misc: set error code when devm_kstrdup fails
authorPan Bian <bianpan2016@163.com>
Sat, 3 Dec 2016 09:29:28 +0000 (17:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Jan 2017 20:46:41 +0000 (21:46 +0100)
commitddc5c9a37be4517270453ce909d3dfcc8de58230
treebdf83a866802e27140fda6be54b63ad4ca50a8e3
parentd77044d142e960f7b5f814a91ecb8bcf86aa552c
misc: set error code when devm_kstrdup fails

In function sram_reserve_regions(), the value of return variable ret
should be negative on failures. However, the value of ret may be 0 even
if the call to devm_kstrdup() returns a NULL pointer. This patch
explicitly assigns "-ENOMEM" to ret on the path that devm_kstrdup()
fails.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188651

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/sram.c