An enumeration is checked by the compiler, so is more robust. It also
helps auto-completion, so is more ergonomic. Change the state attribute
to be of type enum SDCardStates rather than int32_t to achieve both.

Signed-off-by: Bernhard Beschow <[email protected]>
---
 hw/sd/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 03c51b0291..6295e7a942 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -172,7 +172,7 @@ struct SDState {
 
     /* Runtime changeables */
 
-    int32_t state;    /* current card state, one of SDCardStates */
+    enum SDCardStates state; /* current card state */
     uint32_t vhs;
     bool wp_switch;
     unsigned long *wp_group_bmap;
-- 
2.56.0


Reply via email to