RE: [PATCH 3/8] mmc: core: remove BUG_ONs from mmc

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

 



> -----Original Message-----
> From: linux-mmc-owner@xxxxxxxxxxxxxxx [mailto:linux-mmc-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Shawn Lin
> Sent: Wednesday, November 02, 2016 12:56 PM
> To: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> Cc: linux-mmc@xxxxxxxxxxxxxxx; Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
> Subject: [PATCH 3/8] mmc: core: remove BUG_ONs from mmc
> 
> BUG_ONs doesn't help anything except for stop the system from running. If it
> occurs, it implies we should deploy proper error handling for that. So this patch is
> gonna discard these meaningless BUG_ONs and deploy error handling if needed.
> 
> Signed-off-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
> ---
> 
>  drivers/mmc/core/mmc.c     | 14 --------------
>  drivers/mmc/core/mmc_ops.c | 17 -----------------
>  2 files changed, 31 deletions(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index
> e811bd9..4763a35 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1464,7 +1464,6 @@ static int mmc_init_card(struct mmc_host *host, u32
> ocr,
>  	u32 cid[4];
>  	u32 rocr;
> 
> -	BUG_ON(!host);

Instead of just removing BUG_ON, it would be worth adding null check and
return from here graciously as you mentioned in patch commit message,
without which next instruction below may crash if host == NULL.

Similar is the case with other removals below.

>  	WARN_ON(!host->claimed);
> 
>  	/* Set correct bus mode for MMC before attempting init */ @@ -1854,9
> +1853,6 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int
> notify_type)
>   */
>  static void mmc_remove(struct mmc_host *host)  {
> -	BUG_ON(!host);
> -	BUG_ON(!host->card);
> -
>  	mmc_remove_card(host->card);
>  	host->card = NULL;
>  }
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
--
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