usb: gadget: r8a66597: Add missing null check on return from platform_get_resource
authorColin Ian King <colin.king@canonical.com>
Tue, 6 Apr 2021 18:45:10 +0000 (19:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 08:40:24 +0000 (10:40 +0200)
commit57f35fb3e6b11993130e07a5f33c1834aed24a12
treeba38cb46ea66e609e8c2375b1935d2209e52f7cc
parenteb526e869e9ee2b26d89f05818263a7184be84ee
usb: gadget: r8a66597: Add missing null check on return from platform_get_resource

[ Upstream commit 9c2076090c2815fe7c49676df68dde7e60a9b9fc ]

The call to platform_get_resource can potentially return a NULL pointer
on failure, so add this check and return -EINVAL if it fails.

Fixes: c41442474a26 ("usb: gadget: R8A66597 peripheral controller support.")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Dereference null return")
Link: https://lore.kernel.org/r/20210406184510.433497-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/udc/r8a66597-udc.c