Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: renesas_usbhs: fix signed-unsigned return

The return type of usbhsp_setup_pipecfg() was u16 but it was returning
a negative value (-EINVAL). Lets have an additional argument which will
have pipecfg and just return the status (success or error) as the return
from the function.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sudip Mukherjee and committed by
Greg Kroah-Hartman
72f595f3 6fb650d4

+15 -12
+15 -12
drivers/usb/renesas_usbhs/pipe.c
··· 391 391 /* 392 392 * pipe setup 393 393 */ 394 - static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe, 395 - int is_host, 396 - int dir_in) 394 + static int usbhsp_setup_pipecfg(struct usbhs_pipe *pipe, int is_host, 395 + int dir_in, u16 *pipecfg) 397 396 { 398 397 u16 type = 0; 399 398 u16 bfre = 0; ··· 450 451 451 452 /* EPNUM */ 452 453 epnum = 0; /* see usbhs_pipe_config_update() */ 453 - 454 - return type | 455 - bfre | 456 - dblb | 457 - cntmd | 458 - dir | 459 - shtnak | 460 - epnum; 454 + *pipecfg = type | 455 + bfre | 456 + dblb | 457 + cntmd | 458 + dir | 459 + shtnak | 460 + epnum; 461 + return 0; 461 462 } 462 463 463 464 static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe) ··· 702 703 return NULL; 703 704 } 704 705 705 - pipecfg = usbhsp_setup_pipecfg(pipe, is_host, dir_in); 706 + if (usbhsp_setup_pipecfg(pipe, is_host, dir_in, &pipecfg)) { 707 + dev_err(dev, "can't setup pipe\n"); 708 + return NULL; 709 + } 710 + 706 711 pipebuf = usbhsp_setup_pipebuff(pipe); 707 712 708 713 usbhsp_pipe_select(pipe);