Commit 03754ea3 authored by zhengbin's avatar zhengbin Committed by Jens Axboe

paride/pcd: need to check if cd->disk is null in pcd_detect

If alloc_disk fails in pcd_init_units, cd->disk & pi are empty, we need
to check if cd->disk is null in pcd_detect.
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarzhengbin <zhengbin13@huawei.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent d821cce8
...@@ -723,9 +723,9 @@ static int pcd_detect(void) ...@@ -723,9 +723,9 @@ static int pcd_detect(void)
k = 0; k = 0;
if (pcd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */ if (pcd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */
cd = pcd; cd = pcd;
if (pi_init(cd->pi, 1, -1, -1, -1, -1, -1, pcd_buffer, if (cd->disk && pi_init(cd->pi, 1, -1, -1, -1, -1, -1,
PI_PCD, verbose, cd->name)) { pcd_buffer, PI_PCD, verbose, cd->name)) {
if (!pcd_probe(cd, -1, id) && cd->disk) { if (!pcd_probe(cd, -1, id)) {
cd->present = 1; cd->present = 1;
k++; k++;
} else } else
...@@ -736,11 +736,13 @@ static int pcd_detect(void) ...@@ -736,11 +736,13 @@ static int pcd_detect(void)
int *conf = *drives[unit]; int *conf = *drives[unit];
if (!conf[D_PRT]) if (!conf[D_PRT])
continue; continue;
if (!cd->disk)
continue;
if (!pi_init(cd->pi, 0, conf[D_PRT], conf[D_MOD], if (!pi_init(cd->pi, 0, conf[D_PRT], conf[D_MOD],
conf[D_UNI], conf[D_PRO], conf[D_DLY], conf[D_UNI], conf[D_PRO], conf[D_DLY],
pcd_buffer, PI_PCD, verbose, cd->name)) pcd_buffer, PI_PCD, verbose, cd->name))
continue; continue;
if (!pcd_probe(cd, conf[D_SLV], id) && cd->disk) { if (!pcd_probe(cd, conf[D_SLV], id)) {
cd->present = 1; cd->present = 1;
k++; k++;
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment