lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sat, 20 Aug 2011 11:12:26 -0400
From:	Chris Ball <cjb@...top.org>
To:	Namjae Jeon <linkinjeon@...il.com>
Cc:	linux-mmc@...r.kernel.org, linus.walleij@...aro.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mmc: Use switch() instead of if/else if in mmc_blk_issue_rq.

Hi,

On Sat, Aug 20 2011, Namjae Jeon wrote:
> This uses a switch statement instead of if/else if statements.
> It will make to improve clarity and scalability, and offer faster execution through compiler optimization than if/else if statements.
>
> Signed-off-by: Namjae Jeon <linkinjeon@...il.com>
> ---
>  drivers/mmc/card/block.c |   38 +++++++++++++++++++++++---------------
>  1 files changed, 23 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 1ff5486..fe9dd89 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1191,23 +1191,31 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
>  		goto out;
>  	}
>  
> -	if (req && req->cmd_flags & REQ_DISCARD) {
> -		/* complete ongoing async transfer before issuing discard */
> -		if (card->host->areq)
> -			mmc_blk_issue_rw_rq(mq, NULL);
> -		if (req->cmd_flags & REQ_SECURE)
> -			ret = mmc_blk_issue_secdiscard_rq(mq, req);
> -		else
> +	if (req) {
> +		switch(req->cmd_flags) {
> +		case REQ_DISCARD:
> +			/* complete ongoing async transfer before issuing discard */
> +			if (card->host->areq)
> +				mmc_blk_issue_rw_rq(mq, NULL);

But it doesn't work, because you've changed the test for "req->cmd_flags
& REQ_DISCARD" into a test for "req->cmd_flags == REQ_DISCARD".

- Chris.
-- 
Chris Ball   <cjb@...top.org>   <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ