diff mbox

mtd: misplaced parenthesis in find_boot_record()

Message ID 4B79C344.60908@gmail.com
State New, archived
Headers show

Commit Message

roel kluin Feb. 15, 2010, 9:57 p.m. UTC
The parenthesis was misplaced, upon error a one was shown.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---

Comments

David Woodhouse Feb. 26, 2010, 1:08 p.m. UTC | #1
On Mon, 2010-02-15 at 22:57 +0100, Roel Kluin wrote:
> The parenthesis was misplaced, upon error a one was shown.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

> ---
> diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
> index 32e82ae..a269c62 100644
> --- a/drivers/mtd/inftlmount.c
> +++ b/drivers/mtd/inftlmount.c
> @@ -102,7 +102,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
>  		/* To be safer with BIOS, also use erase mark as discriminant */
>  		if ((ret = inftl_read_oob(mtd, block * inftl->EraseSize +
>  					  SECTORSIZE + 8, 8, &retlen,
> -					  (char *)&h1) < 0)) {
> +					  (char *)&h1)) < 0) {

Ick.

This code is broken because it's fugly. You can see the causality just
by looking at it.

Why on earth would you fix the bug but not fix the fugliness which
caused it?

   ret = inftl_read_oob(...);
   if (ret < 0) {
diff mbox

Patch

diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index 32e82ae..a269c62 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -102,7 +102,7 @@  static int find_boot_record(struct INFTLrecord *inftl)
 		/* To be safer with BIOS, also use erase mark as discriminant */
 		if ((ret = inftl_read_oob(mtd, block * inftl->EraseSize +
 					  SECTORSIZE + 8, 8, &retlen,
-					  (char *)&h1) < 0)) {
+					  (char *)&h1)) < 0) {
 			printk(KERN_WARNING "INFTL: ANAND header found at "
 				"0x%x in mtd%d, but OOB data read failed "
 				"(err %d)\n", block * inftl->EraseSize,