Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: gadget: udc: s3c2410_udc: fix return value check in s3c2410_udc_probe()

In case of error, the function devm_platform_ioremap_resource()
returns ERR_PTR() and never returns NULL. The NULL test in the
return value check should be replaced with IS_ERR().

Fixes: 188db4435ac6 ("usb: gadget: s3c: use platform resources")
Cc: stable <stable@vger.kernel.org>
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210305034927.3232386-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Wei Yongjun and committed by
Greg Kroah-Hartman
414c20df b1d25e6e

+2 -2
+2 -2
drivers/usb/gadget/udc/s3c2410_udc.c
··· 1773 1773 udc_info = dev_get_platdata(&pdev->dev); 1774 1774 1775 1775 base_addr = devm_platform_ioremap_resource(pdev, 0); 1776 - if (!base_addr) { 1777 - retval = -ENOMEM; 1776 + if (IS_ERR(base_addr)) { 1777 + retval = PTR_ERR(base_addr); 1778 1778 goto err_mem; 1779 1779 } 1780 1780