Skip to contentSkip to conversation

staging: gdm72xx: compress return logic into one line

PATCH In review Alison Schofield 2 participants 2 messages Feb 10, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: gdm72xx: compress return logic into one line

Simplify function returns by merging assignment and return into one command line.
Found with Coccinelle
@@
expression e, ret;
@@

-ret =
+return

	e;

-return ret;

---
 drivers/staging/gdm72xx/netlink_k.c | 3 +--
 drivers/staging/gdm72xx/usb_boot.c  | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/staging/gdm72xx/netlink_k.c +1 -2
index b7e5e70..cf0b47c 100644
@@ -151,6 +151,5 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len)
 		pr_err("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n",
 		       group, type, len, ret);
 	}
-	ret = 0;
-	return ret;
+	return 0;
 }
drivers/staging/gdm72xx/usb_boot.c +1 -3
index 39ca34031..3082987 100644
@@ -357,7 +357,5 @@ int usb_emergency(struct usb_device *usbdev)
 		return ret;
 	dev_info(&usbdev->dev, "GCT Emergency: Filesystem download success.\n");
 
-	ret = em_fw_reset(usbdev);
-
-	return ret;
+	return em_fw_reset(usbdev);
 }
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Alison Schofield

Simplify function returns by merging assignment and return into one command line.
Found with Coccinelle
@@
expression e, ret;
@@

(quoted diff) +1 -1
-ret =
+return
	e;

-return ret;

Looks good.

Quoted 42 lines
---
 drivers/staging/gdm72xx/netlink_k.c | 3 +--
 drivers/staging/gdm72xx/usb_boot.c  | 4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/staging/gdm72xx/netlink_k.c +1 -2
index b7e5e70..cf0b47c 100644
@@ -151,6 +151,5 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len)
 		pr_err("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n",
 		       group, type, len, ret);
 	}
-	ret = 0;
-	return ret;
+	return 0;
 }
drivers/staging/gdm72xx/usb_boot.c +1 -3
index 39ca34031..3082987 100644
@@ -357,7 +357,5 @@ int usb_emergency(struct usb_device *usbdev)
 		return ret;
 	dev_info(&usbdev->dev, "GCT Emergency: Filesystem download success.\n");
 
-	ret = em_fw_reset(usbdev);
-
-	return ret;
+	return em_fw_reset(usbdev);
 }
Signature · 8 lines
2.1.4

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160210183350.GA12708%40d830.WORKGROUP.
For more options, visit https://groups.google.com/d/optout.