syscon: Avoid returning a device on failure

If the device cannot be probed, syscon_get_by_driver_data() will still
return a useful value in its devp parameter. Ensure that it returns NULL
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass 2016-03-11 22:06:49 -07:00 committed by Bin Meng
parent d74d6b444c
commit 532f2435cf

View File

@ -38,6 +38,7 @@ int syscon_get_by_driver_data(ulong driver_data, struct udevice **devp)
struct uclass *uc;
int ret;
*devp = NULL;
ret = uclass_get(UCLASS_SYSCON, &uc);
if (ret)
return ret;