* [PATCH -next 0/2] minor cleanup for ftdi-elan
@ 2019-01-23 14:16 YueHaibing
2019-01-23 14:16 ` [PATCH -next 1/2] usb: ftdi-elan: remove a unnecessary variable 'empty_packets' YueHaibing
2019-01-23 14:16 ` [PATCH -next 2/2] usb: ftdi-elan: Fix if == else warnings in ftdi_elan_respond_engine YueHaibing
0 siblings, 2 replies; 3+ messages in thread
From: YueHaibing @ 2019-01-23 14:16 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, linux-usb, YueHaibing
YueHaibing (2):
usb: ftdi-elan: remove a unnecessary variable 'empty_packets'
usb: ftdi-elan: Fix if == else warnings in ftdi_elan_respond_engine
drivers/usb/misc/ftdi-elan.c | 26 --------------------------
1 file changed, 26 deletions(-)
--
2.7.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH -next 1/2] usb: ftdi-elan: remove a unnecessary variable 'empty_packets'
2019-01-23 14:16 [PATCH -next 0/2] minor cleanup for ftdi-elan YueHaibing
@ 2019-01-23 14:16 ` YueHaibing
2019-01-23 14:16 ` [PATCH -next 2/2] usb: ftdi-elan: Fix if == else warnings in ftdi_elan_respond_engine YueHaibing
1 sibling, 0 replies; 3+ messages in thread
From: YueHaibing @ 2019-01-23 14:16 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, linux-usb, YueHaibing
The variable 'empty_packets' does not used in any other places
except for self increment, so it can be removed.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/usb/misc/ftdi-elan.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index 76c718a..b2b05c9 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -915,7 +915,6 @@ static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi)
int bytes_read = 0;
int retry_on_empty = 1;
int retry_on_timeout = 3;
- int empty_packets = 0;
read:{
int packet_bytes = 0;
int retval = usb_bulk_msg(ftdi->udev,
@@ -963,7 +962,6 @@ read:{
} else if (packet_bytes == 2) {
unsigned char s0 = ftdi->bulk_in_buffer[0];
unsigned char s1 = ftdi->bulk_in_buffer[1];
- empty_packets += 1;
if (s0 == 0x31 && s1 == 0x60) {
if (retry_on_empty-- > 0) {
goto more;
--
2.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH -next 2/2] usb: ftdi-elan: Fix if == else warnings in ftdi_elan_respond_engine
2019-01-23 14:16 [PATCH -next 0/2] minor cleanup for ftdi-elan YueHaibing
2019-01-23 14:16 ` [PATCH -next 1/2] usb: ftdi-elan: remove a unnecessary variable 'empty_packets' YueHaibing
@ 2019-01-23 14:16 ` YueHaibing
1 sibling, 0 replies; 3+ messages in thread
From: YueHaibing @ 2019-01-23 14:16 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, linux-usb, YueHaibing
Fixes the following coccinelle warning:
./drivers/usb/misc/ftdi-elan.c:972:10-12: WARNING: possible condition with no effect (if == else)
./drivers/usb/misc/ftdi-elan.c:983:9-11: WARNING: possible condition with no effect (if == else)
./drivers/usb/misc/ftdi-elan.c:2052:11-13: WARNING: possible condition with no effect (if == else)
All these else/if branches just do the same thing actually as the last else branch,
So it can be merged into the last branch.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/usb/misc/ftdi-elan.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index b2b05c9..257efac 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -959,30 +959,6 @@ read:{
dev_err(&ftdi->udev->dev, "error = %d with packet_bytes = %d with total %d bytes%s\n",
retval, packet_bytes, bytes_read, diag);
return retval;
- } else if (packet_bytes == 2) {
- unsigned char s0 = ftdi->bulk_in_buffer[0];
- unsigned char s1 = ftdi->bulk_in_buffer[1];
- if (s0 == 0x31 && s1 == 0x60) {
- if (retry_on_empty-- > 0) {
- goto more;
- } else
- return 0;
- } else if (s0 == 0x31 && s1 == 0x00) {
- if (retry_on_empty-- > 0) {
- goto more;
- } else
- return 0;
- } else {
- if (retry_on_empty-- > 0) {
- goto more;
- } else
- return 0;
- }
- } else if (packet_bytes == 1) {
- if (retry_on_empty-- > 0) {
- goto more;
- } else
- return 0;
} else {
if (retry_on_empty-- > 0) {
goto more;
--
2.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-23 14:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23 14:16 [PATCH -next 0/2] minor cleanup for ftdi-elan YueHaibing
2019-01-23 14:16 ` [PATCH -next 1/2] usb: ftdi-elan: remove a unnecessary variable 'empty_packets' YueHaibing
2019-01-23 14:16 ` [PATCH -next 2/2] usb: ftdi-elan: Fix if == else warnings in ftdi_elan_respond_engine YueHaibing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).