public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: stephane duverger <stephane.duverger@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] dbgp: cleanup: remove unneeded check
Date: Wed, 25 Aug 2010 11:57:53 +0000	[thread overview]
Message-ID: <20100825135753.7fab4ba5@riot.ssi.corp> (raw)
In-Reply-To: <20100812074030.GG645@bicker>

Acked-by: Stephane duverger <stephane.duverger@gmail.com>

> len is always greater than or equal to zero here.  First of all, it's
> type is unsigned and also we only assign it numbers which are greater
> than or equal to zero.
> 
> Removing the check lets us pull everything in an indent level.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/usb/gadget/dbgp.c b/drivers/usb/gadget/dbgp.c
> index 0ed50a2..abe4a2e 100644
> --- a/drivers/usb/gadget/dbgp.c
> +++ b/drivers/usb/gadget/dbgp.c
> @@ -386,15 +386,13 @@ static int dbgp_setup(struct usb_gadget *gadget,
>  	} else
>  		goto fail;
>  
> -	if (len >= 0) {
> -		req->length = min(length, len);
> -		req->zero = len < req->length;
> -		if (data && req->length)
> -			memcpy(req->buf, data, req->length);
> -
> -		req->complete = dbgp_setup_complete;
> -		return usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
> -	}
> +	req->length = min(length, len);
> +	req->zero = len < req->length;
> +	if (data && req->length)
> +		memcpy(req->buf, data, req->length);
> +
> +	req->complete = dbgp_setup_complete;
> +	return usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
>  
>  fail:
>  	dev_dbg(&dbgp.gadget->dev,

      reply	other threads:[~2010-08-25 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12  7:40 [patch] dbgp: cleanup: remove unneeded check Dan Carpenter
2010-08-25 11:57 ` stephane duverger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100825135753.7fab4ba5@riot.ssi.corp \
    --to=stephane.duverger@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox