forked from Imagelibrary/rtems
leon,gr1553b: improve init check
Check in init3 not needed since same data is already checked in init2 stage. Adds an extra check that the APB register space is available before accessing it. Updates #2331 but needs to be applied to 4.11 according to ticket.
This commit is contained in:
@@ -191,6 +191,8 @@ static int gr1553_init2(struct drvmgr_dev *dev)
|
||||
return DRVMGR_FAIL;
|
||||
}
|
||||
pnpinfo = &ambadev->info;
|
||||
if ( pnpinfo->apb_slv == NULL )
|
||||
return DRVMGR_EIO;
|
||||
regs = (struct gr1553b_regs *)pnpinfo->apb_slv->start;
|
||||
|
||||
/* Stop IRQ */
|
||||
@@ -227,9 +229,6 @@ static int gr1553_init3(struct drvmgr_dev *dev)
|
||||
|
||||
/* Get device information from AMBA PnP information */
|
||||
ambadev = (struct amba_dev_info *)dev->businfo;
|
||||
if ( ambadev == NULL ) {
|
||||
return DRVMGR_FAIL;
|
||||
}
|
||||
pnpinfo = &ambadev->info;
|
||||
regs = (struct gr1553b_regs *)pnpinfo->apb_slv->start;
|
||||
|
||||
@@ -257,6 +256,12 @@ static int gr1553_init3(struct drvmgr_dev *dev)
|
||||
gr1553_list_add(&gr1553_rt_root, feat);
|
||||
}
|
||||
|
||||
if ( priv->features == 0 ) {
|
||||
/* no features in HW should never happen.. an I/O error? */
|
||||
free(priv);
|
||||
return DRVMGR_EIO;
|
||||
}
|
||||
|
||||
return DRVMGR_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user