Skip to contentSkip to conversation

usb: cdns3: remove redundant assignment to ret on error exit path

PATCH New Colin King 1 participant 1 message Sep 2, 2019

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 usb: cdns3: remove redundant assignment to ret on error exit path

From: Colin Ian King <[email protected]>

In the case where an allocation fails for priv_ep ret is assigned -ENOMEM and the code exits via the exit path 'err'. The exit path returns -ENOMEM without using variable ret, so the assingment is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/usb/cdns3/gadget.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/cdns3/gadget.c +1 -3
index 0eb3022838d6..de0e14a4fb9f 100644
@@ -2447,10 +2447,8 @@ static int cdns3_init_eps(struct cdns3_device *priv_dev)
 
 		priv_ep = devm_kzalloc(priv_dev->dev, sizeof(*priv_ep),
 				       GFP_KERNEL);
-		if (!priv_ep) {
-			ret = -ENOMEM;
+		if (!priv_ep)
 			goto err;
-		}
 
 		/* set parent of endpoint object */
 		priv_ep->cdns3_dev = priv_dev;
Signature · 1 line
2.20.1