Skip to contentSkip to conversation

Fix coding style errors

PATCH In review Brandon Stewart 2 participants 2 messages Jan 28, 2014 – Jan 31, 2014 Linux for power macintosh

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Fix coding style errors

I corrected several coding errors.

---
 drivers/macintosh/adb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/macintosh/adb.c +4 -3
index 53611de..dd3f49a 100644
@@ -623,7 +623,7 @@ do_adb_query(struct adb_request *req)
 {
 	int	ret = -EINVAL;
 
-	switch(req->data[1]) {
+	switch (req->data[1]) {
 	case ADB_QUERY_GETDEVINFO:
 		if (req->nbytes < 3)
 			break;
@@ -792,8 +792,9 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
 	}
 	/* Special case for ADB_BUSRESET request, all others are sent to
 	   the controller */
-	else if ((req->data[0] == ADB_PACKET) && (count > 1)
-		&& (req->data[1] == ADB_BUSRESET)) {
+	else if (req->data[0] == ADB_PACKET &&
+		req->data[1] == ADB_BUSRESET &&
+		count > 1) {
 		ret = do_adb_reset_bus();
 		up(&adb_probe_mutex);
 		atomic_dec(&state->n_pending);
Signature · 1 line
1.8.5.3
#1 lore raw
Quoted 21 lines · Brandon Stewart

I corrected several coding errors.

---
 drivers/macintosh/adb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/macintosh/adb.c +1 -1
index 53611de..dd3f49a 100644
@@ -623,7 +623,7 @@ do_adb_query(struct adb_request *req)
 {
 	int	ret = -EINVAL;
 
-	switch(req->data[1]) {
+	switch (req->data[1]) {
 	case ADB_QUERY_GETDEVINFO:
 		if (req->nbytes < 3)
 			break;

drivers/macintosh/adb.c static ssize_t adb_write(struct file *file, const char __user *buf, · line 797

Quoted 8 lines
drivers/macintosh/adb.c +3 -2
@@ -792,8 +792,9 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
 	}
 	/* Special case for ADB_BUSRESET request, all others are sent to
 	   the controller */
-	else if ((req->data[0] == ADB_PACKET) && (count > 1)
-		&& (req->data[1] == ADB_BUSRESET)) {
+	else if (req->data[0] == ADB_PACKET &&
+		req->data[1] == ADB_BUSRESET &&
+		count > 1) {

Is this re-ordering safe? Isn't 'count > 1' notionally indicating whether req->data[1] exists to be tested in the first place?

On the other hand there's a check at the top of the routine that returns if count < 2, so maybe the check here should be removed altogether (along with one a few lines above)?