lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190523132334.29611-1-nishkadg.linux@gmail.com>
Date:   Thu, 23 May 2019 18:53:34 +0530
From:   Nishka Dasgupta <nishkadg.linux@...il.com>
To:     gregkh@...uxfoundation.org, christian.gromm@...rochip.com,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Cc:     Nishka Dasgupta <nishkadg.linux@...il.com>
Subject: [PATCH] staging: most: usb: Remove variable frame_size

Remove variable frame_size as its multiple usages are all independent of
each other and so can be returned separately.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@...il.com>
---
 drivers/staging/most/usb/usb.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index 360cb5b7a10b..751e82cf66c5 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -186,32 +186,28 @@ static inline int start_sync_ep(struct usb_device *usb_dev, u16 ep)
  */
 static unsigned int get_stream_frame_size(struct most_channel_config *cfg)
 {
-	unsigned int frame_size = 0;
 	unsigned int sub_size = cfg->subbuffer_size;
 
 	if (!sub_size) {
 		pr_warn("Misconfig: Subbuffer size zero.\n");
-		return frame_size;
+		return 0;
 	}
 	switch (cfg->data_type) {
 	case MOST_CH_ISOC:
-		frame_size = AV_PACKETS_PER_XACT * sub_size;
-		break;
+		return AV_PACKETS_PER_XACT * sub_size;
 	case MOST_CH_SYNC:
 		if (cfg->packets_per_xact == 0) {
 			pr_warn("Misconfig: Packets per XACT zero\n");
-			frame_size = 0;
+			return 0;
 		} else if (cfg->packets_per_xact == 0xFF) {
-			frame_size = (USB_MTU / sub_size) * sub_size;
+			return (USB_MTU / sub_size) * sub_size;
 		} else {
-			frame_size = cfg->packets_per_xact * sub_size;
+			return cfg->packets_per_xact * sub_size;
 		}
-		break;
 	default:
 		pr_warn("Query frame size of non-streaming channel\n");
-		break;
+		return 0;
 	}
-	return frame_size;
 }
 
 /**
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ