File tree 1 file changed +6
-8
lines changed
zircon-object/src/dev/pci 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -33,23 +33,21 @@ pub struct PcieUpstream {
33
33
34
34
struct PcieUpstreamInner {
35
35
weak_super : Weak < dyn IPciNode > ,
36
- downstream : [ Option < Arc < dyn IPciNode > > ; PCI_MAX_FUNCTIONS_PER_BUS ] ,
36
+ downstream : Box < [ Option < Arc < dyn IPciNode > > ] > ,
37
37
}
38
38
39
39
impl PcieUpstream {
40
- #[ allow( unsafe_code) ]
41
40
pub fn create ( managed_bus_id : usize ) -> Arc < Self > {
42
41
Arc :: new ( PcieUpstream {
43
42
managed_bus_id,
44
43
inner : Mutex :: new ( PcieUpstreamInner {
45
44
weak_super : Weak :: < PciRoot > :: new ( ) ,
46
- downstream : unsafe {
47
- core :: mem :: transmute (
48
- [ 0u8 ; core :: mem :: size_of :: < Option < Arc < dyn IPciNode > > > ( )
49
- * PCI_MAX_FUNCTIONS_PER_BUS ] ,
50
- )
45
+ downstream : {
46
+ let mut vec =
47
+ Vec :: < Option < Arc < dyn IPciNode > > > :: with_capacity ( PCI_MAX_FUNCTIONS_PER_BUS ) ;
48
+ vec . resize ( PCI_MAX_FUNCTIONS_PER_BUS , None ) ;
49
+ vec . into_boxed_slice ( )
51
50
} ,
52
- // [None; PCI_MAX_FUNCTIONS_PER_BUS],
53
51
} ) ,
54
52
} )
55
53
}
You can’t perform that action at this time.
0 commit comments