[PATCH v1 1/2] lsusb: Squash Wpointer-compare warning.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This squashes "warning: comparison between pointer and zero character"

This was an empty string check that was checking the pointer rather
than the first character.  The check was done correctly before the
string was used, so here we yank the correct check up, to the upper
level, replacing the ineffectual/broken one.

Signed-off-by: Michael Drake <michael.drake@xxxxxxxxxxxxxxx>
---
 desc-dump.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/desc-dump.c b/desc-dump.c
index 5c8e8ae..0df0e00 100644
--- a/desc-dump.c
+++ b/desc-dump.c
@@ -64,17 +64,16 @@ static void desc_bmcontrol_dump(
 	       (type == DESC_BMCONTROL_2));
 
 	while (strings[count] != NULL) {
-		if (strings[0] != '\0') {
+		if (strings[count][0] != '\0') {
 			if (type == DESC_BMCONTROL_1) {
-				if ((strings[count][0] != '\0') &&
-				    (bmcontrols >> count) & 0x1) {
+				if ((bmcontrols >> count) & 0x1) {
 					printf("%*s%s Control\n",
 							indent * 2, "",
 							strings[count]);
 				}
 			} else {
 				control = (bmcontrols >> (count * 2)) & 0x3;
-				if ((strings[count][0] != '\0') && control) {
+				if (control) {
 					printf("%*s%s Control (%s)\n",
 							indent * 2, "",
 							strings[count],
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux