dm: Use uclass_first_device_err() where it is useful

Use this new function in places where it simplifies the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2016-02-11 13:23:26 -07:00
parent b06750501f
commit 3f603cbbb8
17 changed files with 30 additions and 54 deletions

View File

@@ -242,7 +242,7 @@ static uint32_t tpm_sendrecv_command(const void *command,
response_length = sizeof(response_buffer);
}
ret = uclass_first_device(UCLASS_TPM, &dev);
ret = uclass_first_device_err(UCLASS_TPM, &dev);
if (ret)
return ret;
err = tpm_xfer(dev, command, tpm_command_size(command),
@@ -261,8 +261,8 @@ int tpm_init(void)
int err;
struct udevice *dev;
err = uclass_first_device(UCLASS_TPM, &dev);
if (err || !dev)
err = uclass_first_device_err(UCLASS_TPM, &dev);
if (err)
return err;
return tpm_open(dev);
}