usb: dwc3: qcom: Improve error handling
authorLee Jones <lee.jones@linaro.org>
Mon, 17 Jun 2019 12:51:05 +0000 (13:51 +0100)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 18 Jun 2019 08:58:29 +0000 (11:58 +0300)
commit7f5d6a4696170ca7394d9dcecd5a54ebe2b9a067
treed5cd69bfe3318a4d1de71ab7e26575acb1997716
parenta6e456209d088df31eacfa877d40194c755ca153
usb: dwc3: qcom: Improve error handling

dwc3_qcom_clk_init() is called with of_count_phandle_with_args() as an
argument.  If of_count_phandle_with_args() returns an error, the number
of clocks will be a negative value and will lead to undefined behaviour.

Ensure we check for an error before attempting to blindly use the value.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/dwc3-qcom.c