Commit
b76105e359a7 ("usb: pd: Read sink capabilities from device
tree") added support in usbpd driver to pass sink capablities from
device tree. But it introduced bug in case of no sink capablities
passed from device tree as in this case, device_property_read_u32_array()
returns -EINVAL. Due to this, usbpd driver probe fails as usbpd_create()
returns errors. Fix this issue by checking if return value > 0 and then
only try to read sink capablities from device tree. If not, use default
sink capabliites defined in usbpd driver.
Change-Id: I51beeba282c6e067881c664d38c2657843a1c716
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
pd->num_sink_caps = device_property_read_u32_array(parent,
"qcom,default-sink-caps", NULL, 0);
- if (pd->num_sink_caps) {
+ if (pd->num_sink_caps > 0) {
int i;
u32 sink_caps[14];