Skip to contentSkip to conversation

usb: gadget: xudc: fix return value check in xudc_probe()

PATCH New weiyj_lk at 163.com 3 participants 3 messages Apr 16, 2015 – Apr 27, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: xudc: fix return value check in xudc_probe()

From: Wei Yongjun <[email protected]>

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

---
 drivers/usb/gadget/udc/udc-xilinx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/udc-xilinx.c +2 -2
index dd3e9fd..cfe0349 100644
@@ -2071,8 +2071,8 @@ static int xudc_probe(struct platform_device *pdev)
 	/* Map the registers */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	udc->addr = devm_ioremap_resource(&pdev->dev, res);
-	if (!udc->addr)
-		return -ENOMEM;
+	if (IS_ERR(udc->addr))
+		return PTR_ERR(udc->addr);
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
#1 lore raw

PATCH 1/1 usb: gadget: xudc: fix return value check in xudc_probe()

Quoted 17 lines · On 04/16/2015 02:17 PM, weiyj_lk at 163.com wrote:

From: Wei Yongjun <[email protected]>

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

---
 drivers/usb/gadget/udc/udc-xilinx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/udc-xilinx.c +0 -0
index dd3e9fd..cfe0349 100644

drivers/usb/gadget/udc/udc-xilinx.c static int xudc_probe(struct platform_device *pdev) · line 2078

Quoted 10 lines
drivers/usb/gadget/udc/udc-xilinx.c +2 -2
@@ -2071,8 +2071,8 @@ static int xudc_probe(struct platform_device *pdev)
 	/* Map the registers */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	udc->addr = devm_ioremap_resource(&pdev->dev, res);
-	if (!udc->addr)
-		return -ENOMEM;
+	if (IS_ERR(udc->addr))
+		return PTR_ERR(udc->addr);
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {

Thanks,
Michal

#2 lore raw

PATCH 1/1 usb: gadget: xudc: fix return value check in xudc_probe()

In reply to weiyj_lk at 163.com

Hi,

Quoted 7 lines · On Thu, Apr 16, 2015 at 08:17:30PM +0800, weiyj_lk at 163.com wrote:

From: Wei Yongjun <[email protected]>

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

doesn't apply to v4.1-rc1, if it's still needed, please rebase.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150427/d4a38313/attachment.sig>