Re: [PATCH] mmc: sdio: get seg_size after the check of card

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21 August 2016 at 06:30, Shawn Lin <shawn.lin@xxxxxxxxxxxxxx> wrote:
> When using mmc_io_rw_extended. it's intent to avoid
> null pointer of card but actually it didn't prevent
> it as the seg_size already use the card. So we need
> to move this after the check.
>
> Signed-off-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
> ---
>
>  drivers/mmc/core/sdio_ops.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
> index 34f6e80..15a06b8 100644
> --- a/drivers/mmc/core/sdio_ops.c
> +++ b/drivers/mmc/core/sdio_ops.c
> @@ -127,7 +127,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
>         struct scatterlist sg, *sg_ptr;
>         struct sg_table sgtable;
>         unsigned int nents, left_size, i;
> -       unsigned int seg_size = card->host->max_seg_size;
> +       unsigned int seg_size;
>
>         BUG_ON(!card);
>         BUG_ON(fn > 7);

Can we try to remove these BUG_ONs() instead and deploy proper error
handling - if needed.

> @@ -137,6 +137,8 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
>         if (addr & ~0x1FFFF)
>                 return -EINVAL;
>
> +       seg_size = card->host->max_seg_size;
> +
>         mrq.cmd = &cmd;
>         mrq.data = &data;
>
> --
> 2.3.7
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux