Actually check to see if XPT_CALC_GEOMETRY had an error
and pick a bogus geometry if it had so we don't later get a divide by zero trap.
This commit is contained in:
parent
5b9fdd582c
commit
9dcfabf816
@ -1865,10 +1865,24 @@ dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector)
|
||||
ccg.secs_per_track = 0;
|
||||
ccg.cylinders = 0;
|
||||
xpt_action((union ccb*)&ccg);
|
||||
if ((ccg.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
|
||||
/*
|
||||
* We don't know what went wrong here- but just pick
|
||||
* a geometry so we don't have nasty things like divide
|
||||
* by zero.
|
||||
*/
|
||||
dp->heads = 255;
|
||||
dp->secs_per_track = 255;
|
||||
dp->cylinders = dp->sectors / (255 * 255);
|
||||
if (dp->cylinders == 0) {
|
||||
dp->cylinders = 1;
|
||||
}
|
||||
} else {
|
||||
dp->heads = ccg.heads;
|
||||
dp->secs_per_track = ccg.secs_per_track;
|
||||
dp->cylinders = ccg.cylinders;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dasendorderedtag(void *arg)
|
||||
|
Loading…
Reference in New Issue
Block a user