Patchwork [04/10] hw/sd.c: When setting ADDRESS_ERROR bit, don't clear everything else

login
register
mail settings
Submitter Peter Maydell
Date Dec. 18, 2011, 8:37 p.m.
Message ID <1324240680-26905-5-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/132120/
State New
Headers show

Comments

Peter Maydell - Dec. 18, 2011, 8:37 p.m.
Fix a typo that meant that ADDRESS_ERRORs setting or clearing write
protection would clear every other bit in the status register.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/sd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/sd.c b/hw/sd.c
index e57852e..dd28061 100644
--- a/hw/sd.c
+++ b/hw/sd.c
@@ -999,7 +999,7 @@  static sd_rsp_type_t sd_normal_command(SDState *sd,
         switch (sd->state) {
         case sd_transfer_state:
             if (addr >= sd->size) {
-                sd->card_status = ADDRESS_ERROR;
+                sd->card_status |= ADDRESS_ERROR;
                 return sd_r1b;
             }
 
@@ -1019,7 +1019,7 @@  static sd_rsp_type_t sd_normal_command(SDState *sd,
         switch (sd->state) {
         case sd_transfer_state:
             if (addr >= sd->size) {
-                sd->card_status = ADDRESS_ERROR;
+                sd->card_status |= ADDRESS_ERROR;
                 return sd_r1b;
             }