mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
part: return -ENOSYS when get_info not valid.
In some case, get_info() interface can be NULL, add this check to stop from crash. Signed-off-by: schspa <schspa@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
0171d056ec
commit
50f7b2effd
1 changed files with 7 additions and 0 deletions
|
@ -668,6 +668,13 @@ int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name,
|
|||
part_drv = part_driver_lookup_type(dev_desc);
|
||||
if (!part_drv)
|
||||
return -1;
|
||||
|
||||
if (!part_drv->get_info) {
|
||||
log_debug("## Driver %s does not have the get_info() method\n",
|
||||
part_drv->name);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
for (i = 1; i < part_drv->max_entries; i++) {
|
||||
ret = part_drv->get_info(dev_desc, i, info);
|
||||
if (ret != 0) {
|
||||
|
|
Loading…
Reference in a new issue