Skip to contentSkip to conversation

m25p80: add missing blk_attach_dev_nofail

PATCH Applied Paolo Bonzini 3 participants 3 messages Apr 14, 2015 – Apr 21, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 m25p80: add missing blk_attach_dev_nofail

Of the block devices that poked into -drive options via drive_get_next, m25p80 was the only one who also did not attach itself to the BlockBackend.

Since sd does it, and all other devices go through a "drive" property, with this change all block backends attached to the guest will have a non-NULL result for blk_get_attached_dev().

---
 hw/block/m25p80.c | 1 +
 1 file changed, 1 insertion(+)
hw/block/m25p80.c +1 -0
index afe243b..728e384 100644
@@ -629,6 +629,7 @@ static int m25p80_init(SSISlave *ss)
     if (dinfo) {
         DB_PRINT_L(0, "Binding to IF_MTD drive\n");
         s->blk = blk_by_legacy_dinfo(dinfo);
+        blk_attach_dev_nofail(s->blk, s);
 
         /* FIXME: Move to late init */
         if (blk_read(s->blk, 0, s->storage,
Signature · 1 line
2.3.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Paolo Bonzini

Of the block devices that poked into -drive options via drive_get_next, m25p80 was the only one who also did not attach itself to the BlockBackend.

Since sd does it, and all other devices go through a "drive" property, with this change all block backends attached to the guest will have a non-NULL result for blk_get_attached_dev().

Quoted 20 lines
---
 hw/block/m25p80.c | 1 +
 1 file changed, 1 insertion(+)
hw/block/m25p80.c +1 -1
index afe243b..728e384 100644
@@ -629,6 +629,7 @@ static int m25p80_init(SSISlave *ss)
     if (dinfo) {
         DB_PRINT_L(0, "Binding to IF_MTD drive\n");
         s->blk = blk_by_legacy_dinfo(dinfo);
+        blk_attach_dev_nofail(s->blk, s);
 
         /* FIXME: Move to late init */
         if (blk_read(s->blk, 0, s->storage,
--

2.3.5

#2 lore raw
In reply to Paolo Bonzini
Quoted 11 lines · Paolo Bonzini

Of the block devices that poked into -drive options via drive_get_next, m25p80 was the only one who also did not attach itself to the BlockBackend.

Since sd does it, and all other devices go through a "drive" property, with this change all block backends attached to the guest will have a non-NULL result for blk_get_attached_dev().

---
 hw/block/m25p80.c | 1 +
 1 file changed, 1 insertion(+)

Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next

Stefan