linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] Fix coding style errors
@ 2014-01-28  3:07 Brandon Stewart
  2014-01-31 19:34 ` Brian W Hart
  0 siblings, 1 reply; 2+ messages in thread
From: Brandon Stewart @ 2014-01-28  3:07 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev, linux-kernel

I corrected several coding errors.

Signed-off-by: Brandon Stewart <stewartb2@gmail.com>
---
 drivers/macintosh/adb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 53611de..dd3f49a 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -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);
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] Fix coding style errors
  2014-01-28  3:07 [PATCH 2/2] Fix coding style errors Brandon Stewart
@ 2014-01-31 19:34 ` Brian W Hart
  0 siblings, 0 replies; 2+ messages in thread
From: Brian W Hart @ 2014-01-31 19:34 UTC (permalink / raw)
  To: linuxppc-dev

On Mon, Jan 27, 2014 at 09:07:34PM -0600, Brandon Stewart wrote:
> I corrected several coding errors.
> 
> Signed-off-by: Brandon Stewart <stewartb2@gmail.com>
> ---
>  drivers/macintosh/adb.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
> index 53611de..dd3f49a 100644
> --- a/drivers/macintosh/adb.c
> +++ b/drivers/macintosh/adb.c
> @@ -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) {

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)?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-31 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28  3:07 [PATCH 2/2] Fix coding style errors Brandon Stewart
2014-01-31 19:34 ` Brian W Hart

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).