File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -251,11 +251,11 @@ static int dwc3_octeon_get_divider(void)
251
251
while (div < ARRAY_SIZE (clk_div )) {
252
252
uint64_t rate = octeon_get_io_clock_rate () / clk_div [div ];
253
253
if (rate <= 300000000 && rate >= 150000000 )
254
- break ;
254
+ return div ;
255
255
div ++ ;
256
256
}
257
257
258
- return div ;
258
+ return - EINVAL ;
259
259
}
260
260
261
261
static int dwc3_octeon_setup (struct dwc3_octeon * octeon ,
@@ -289,6 +289,10 @@ static int dwc3_octeon_setup(struct dwc3_octeon *octeon,
289
289
290
290
/* Step 4b: Select controller clock frequency. */
291
291
div = dwc3_octeon_get_divider ();
292
+ if (div < 0 ) {
293
+ dev_err (dev , "clock divider invalid\n" );
294
+ return div ;
295
+ }
292
296
val = dwc3_octeon_readq (uctl_ctl_reg );
293
297
val &= ~USBDRD_UCTL_CTL_H_CLKDIV_SEL ;
294
298
val |= FIELD_PREP (USBDRD_UCTL_CTL_H_CLKDIV_SEL , div );
You can’t perform that action at this time.
0 commit comments