dm: core: Add uclass_first_device_err() to return a valid device
authorSimon Glass <sjg@chromium.org>
Thu, 11 Feb 2016 20:23:25 +0000 (13:23 -0700)
committerSimon Glass <sjg@chromium.org>
Mon, 14 Mar 2016 21:34:50 +0000 (15:34 -0600)
commitb06750501f5c0eef7fef094f13d2f2e313c60b79
treed0dfd81b292e93e73227e015246382ac4a6f689b
parentdf61a74e6845ec9bdcdd48d2aff5e9c2c6debeaa
dm: core: Add uclass_first_device_err() to return a valid device

A common pattern is to call uclass_first_device() and then check if it
actually returns a device. Add a new function which does this, returning
an error if there are no devices in that uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/core/uclass.c
include/dm/uclass.h