diff mbox

mmc: block: return errorcode and not 0

Message ID 20170213144038.975-1-linus.walleij@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Linus Walleij Feb. 13, 2017, 2:40 p.m. UTC
The function mmc_sd_num_wr_blocks() was changed in
9a5e7ddc7954: "mmc: block: return errorcode from mmc_sd_num_wr_blocks()"
to return err; but this was fixed in
65f2da1ecb36: "mmc: block: return 0 where evident"
as clearly err was anyways zero.

Well the first commit was wrong, we should have returned an
errorcode all the time.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 65f2da1ecb36: ("mmc: block: return 0 where evident")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Ulf please apply this for fixes.
---
 drivers/mmc/core/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ulf Hansson Feb. 14, 2017, 8:16 a.m. UTC | #1
On 13 February 2017 at 15:40, Linus Walleij <linus.walleij@linaro.org> wrote:
> The function mmc_sd_num_wr_blocks() was changed in
> 9a5e7ddc7954: "mmc: block: return errorcode from mmc_sd_num_wr_blocks()"
> to return err; but this was fixed in
> 65f2da1ecb36: "mmc: block: return 0 where evident"
> as clearly err was anyways zero.
>
> Well the first commit was wrong, we should have returned an
> errorcode all the time.

As both of the fixed commits is still only in my tree, I decided to
fold this change into the first one ("mmc: block: return errorcode
from mmc_sd_num_wr_blocks()" and the drop the second ("mmc: block:
return 0 where evident"). In this way we get clean git history and
avoid bisect issues.

I also added a little information in the change-log of the amended
commit about the update.

>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 65f2da1ecb36: ("mmc: block: return 0 where evident")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Applied for next!

Kind regards
Uffe

> ---
> Ulf please apply this for fixes.
> ---
>  drivers/mmc/core/block.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 985477cdcb3e..cd909aecfded 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -783,7 +783,7 @@ static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
>         if (err)
>                 return err;
>         if (!mmc_host_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD))
> -               return 0;
> +               return -EIO;
>
>         memset(&cmd, 0, sizeof(struct mmc_command));
>
> --
> 2.9.3
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 985477cdcb3e..cd909aecfded 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -783,7 +783,7 @@  static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
 	if (err)
 		return err;
 	if (!mmc_host_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD))
-		return 0;
+		return -EIO;
 
 	memset(&cmd, 0, sizeof(struct mmc_command));