mmc: block: use pr_err_ratelimited for command errors

Switch to using pr_err_ratelimited in order to avoid
flooding the logs in case of error function gets
called repeatedly.

Change-Id: I636dc933915127a43ad4da87a565f8f585e6df90
Signed-off-by: Talel Shenhar <tatias@codeaurora.org>
This commit is contained in:
Talel Shenhar 2015-01-28 14:44:57 +02:00 committed by Subhash Jadavani
parent 1e5451c60d
commit 0baf8a894a

View file

@ -1237,18 +1237,21 @@ static int mmc_blk_cmd_error(struct request *req, const char *name, int error,
switch (error) { switch (error) {
case -EILSEQ: case -EILSEQ:
/* response crc error, retry the r/w cmd */ /* response crc error, retry the r/w cmd */
pr_err("%s: %s sending %s command, card status %#x\n", pr_err_ratelimited(
req->rq_disk->disk_name, "response CRC error", "%s: response CRC error sending %s command, card status %#x\n",
req->rq_disk->disk_name,
name, status); name, status);
return ERR_RETRY; return ERR_RETRY;
case -ETIMEDOUT: case -ETIMEDOUT:
pr_err("%s: %s sending %s command, card status %#x\n", pr_err_ratelimited(
req->rq_disk->disk_name, "timed out", name, status); "%s: timed out sending %s command, card status %#x\n",
req->rq_disk->disk_name, name, status);
/* If the status cmd initially failed, retry the r/w cmd */ /* If the status cmd initially failed, retry the r/w cmd */
if (!status_valid) { if (!status_valid) {
pr_err("%s: status not valid, retrying timeout\n", req->rq_disk->disk_name); pr_err_ratelimited("%s: status not valid, retrying timeout\n",
req->rq_disk->disk_name);
return ERR_RETRY; return ERR_RETRY;
} }
/* /*
@ -1257,17 +1260,22 @@ static int mmc_blk_cmd_error(struct request *req, const char *name, int error,
* have corrected the state problem above. * have corrected the state problem above.
*/ */
if (status & (R1_COM_CRC_ERROR | R1_ILLEGAL_COMMAND)) { if (status & (R1_COM_CRC_ERROR | R1_ILLEGAL_COMMAND)) {
pr_err("%s: command error, retrying timeout\n", req->rq_disk->disk_name); pr_err_ratelimited(
"%s: command error, retrying timeout\n",
req->rq_disk->disk_name);
return ERR_RETRY; return ERR_RETRY;
} }
/* Otherwise abort the command */ /* Otherwise abort the command */
pr_err("%s: not retrying timeout\n", req->rq_disk->disk_name); pr_err_ratelimited(
"%s: not retrying timeout\n",
req->rq_disk->disk_name);
return ERR_ABORT; return ERR_ABORT;
default: default:
/* We don't understand the error code the driver gave us */ /* We don't understand the error code the driver gave us */
pr_err("%s: unknown error %d sending read/write command, card status %#x\n", pr_err_ratelimited(
"%s: unknown error %d sending read/write command, card status %#x\n",
req->rq_disk->disk_name, error, status); req->rq_disk->disk_name, error, status);
return ERR_ABORT; return ERR_ABORT;
} }