MLK-20240-7 fastboot: Add NULL return check

Fix coverity issue CID 1898965: Dereference null return value (NULL_RETURNS)
dereference: Dereferencing a pointer that might be NULL dev_desc when calling
write_backup_gpt_partitions

Signed-off-by: Ye Li <ye.li@nxp.com>
This commit is contained in:
Ye Li 2018-11-12 03:47:33 -08:00
parent 7bc5136e52
commit 661bc6ec62
1 changed files with 5 additions and 0 deletions

View File

@ -880,6 +880,11 @@ int write_backup_gpt(void)
return -1;
}
dev_desc = blk_get_dev("mmc", mmc_no);
if (dev_desc == NULL) {
printf("Can't get Block device MMC %d\n",
mmc_no);
return -ENODEV;
}
/* write backup get partition */
if (write_backup_gpt_partitions(dev_desc, interface.transfer_buffer)) {