Skip to content

Commit 05e78c6

Browse files
felixhaedickeFelipe Balbi
authored andcommitted
usb: gadget: f_fs: fix wrong parenthesis in ffs_func_req_match()
Properly check the return code of ffs_func_revmap_intf() and ffs_func_revmap_ep() for a non-negative value. Instead of checking the return code, the comparison was performed for the last parameter of the function calls, because of wrong parenthesis. This also fixes the following static checker warning: drivers/usb/gadget/function/f_fs.c:3152 ffs_func_req_match() warn: always true condition '(((creq->wIndex)) >= 0) => (0-u16max >= 0)' Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felix Hädicke <felixhaedicke@web.de> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
1 parent a25f094 commit 05e78c6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • drivers/usb/gadget/function

drivers/usb/gadget/function/f_fs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3225,11 +3225,11 @@ static bool ffs_func_req_match(struct usb_function *f,
32253225

32263226
switch (creq->bRequestType & USB_RECIP_MASK) {
32273227
case USB_RECIP_INTERFACE:
3228-
return ffs_func_revmap_intf(func,
3229-
le16_to_cpu(creq->wIndex) >= 0);
3228+
return (ffs_func_revmap_intf(func,
3229+
le16_to_cpu(creq->wIndex)) >= 0);
32303230
case USB_RECIP_ENDPOINT:
3231-
return ffs_func_revmap_ep(func,
3232-
le16_to_cpu(creq->wIndex) >= 0);
3231+
return (ffs_func_revmap_ep(func,
3232+
le16_to_cpu(creq->wIndex)) >= 0);
32333233
default:
32343234
return (bool) (func->ffs->user_flags &
32353235
FUNCTIONFS_ALL_CTRL_RECIP);

0 commit comments

Comments
 (0)