# \[PATCH v4 2/3\] mmc: core: add random fault injection

- From: Akinobu Mita \<akinobu.mita@gmail.com\>
- Date: 2011-07-26 23:17:21 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2011/07/3745395
- Thread: https://ratatoskr.run/linux-arm-kernel/2011/07/3745341/t.md

```text
2011/7/27 Per Forlin [ref]:
> This adds support to inject data errors after a completed host transfer.
> The mmc core will return error even though the host transfer is successful.
> This simple fault injection proved to be very useful to test the
> non-blocking error handling in the mmc_blk_issue_rw_rq().
> Random faults can also test how the host driver handles pre_req()
> and post_req() in case of errors.

Looks good but I have one question.

> @@ -304,6 +307,10 @@ struct mmc_host {
>
> ? ? ? ?struct mmc_async_req ? ?*areq; ? ? ? ? ?/* active async req */
>
> +#ifdef CONFIG_FAIL_MMC_REQUEST
> + ? ? ? u8 ? ? ? ? ? ? ? ? ? ? ?make_it_fail;
> + ? ? ? struct fault_attr ? ? ? fail_mmc_request;
> +#endif
> ? ? ? ?unsigned long ? ? ? ? ? private[0] ____cacheline_aligned;
> ?};

I think make_it_fail is not needed anymore because if fail_attr is
defined per-host then you can enable it by setting probability=0
or times=0 per-host.
```
