MMC - Driver hangs if using bad SDCard

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

 



Hi
 
I have experienced problems with the MMC driver if using an bad SD card the MMC 
driver ends up in an infinite loop in file block.c function mmc_blk_issue_rq.
 
if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) {
                                                                                       
do {
                                                                                                                    
int err;
 
                                                                                                                    
cmd.opcode = MMC_SEND_STATUS;
                                                                                                                    
cmd.arg = card->rca << 16;
                                                                                                                    
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
                                                                                                                    
err = mmc_wait_for_cmd(card->host, &cmd, 5);
                                                                                                                    
if (err) {
                                                                                                                                                 
printk(KERN_ERR "%s: error %d requesting status\n",
                                                                                                                                                        
req->rq_disk->disk_name, err);
                                                                                                                                                 
goto cmd_err;
                                                                                                                    
}
                                                                                                                    
/*
                                                                                                                     
* Some cards mishandle the status bits,
                                                                                                                     
* so make sure to check both the busy
                                                                                                                     
* indication and the card state.
                                                                                                                     
*/
                                                                                       
} while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
                                                                                                                    
(R1_CURRENT_STATE(cmd.resp[0]) == 7));
 
 
The problem is that  R1_CURRENT_STATE(cmd.resp[0]) == 7 will always be TRUE. 
This problem will drain the battery on portabel devices.
The card works fine on other devices.
My idea to solve this problem is to break this loop by an timer if it take too 
long time for the SD-Card to replay. Will that solution break anything? Any 
other better solutions?
 
BR
Lekan

--
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