Commit 1aa3c63cf0a79153ee13c8f82e4eb6c40b66a161

Authored by Alan Cox
Committed by Greg Kroah-Hartman
1 parent 42ca7da1c2

USB: mct_u232: Fix incorrect TIOCMSET return

The low level helper returns 1 on success. The ioctl should however return
0. As this is the only user of the helper return, make the helper return 0 or
an error code.

Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=43009
Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 8 additions and 5 deletions Side-by-side Diff

drivers/usb/serial/mct_u232.c
... ... @@ -309,13 +309,16 @@
309 309 MCT_U232_SET_REQUEST_TYPE,
310 310 0, 0, buf, MCT_U232_SET_MODEM_CTRL_SIZE,
311 311 WDR_TIMEOUT);
312   - if (rc < 0)
313   - dev_err(&serial->dev->dev,
314   - "Set MODEM CTRL 0x%x failed (error = %d)\n", mcr, rc);
  312 + kfree(buf);
  313 +
315 314 dbg("set_modem_ctrl: state=0x%x ==> mcr=0x%x", control_state, mcr);
316 315  
317   - kfree(buf);
318   - return rc;
  316 + if (rc < 0) {
  317 + dev_err(&serial->dev->dev,
  318 + "Set MODEM CTRL 0x%x failed (error = %d)\n", mcr, rc);
  319 + return rc;
  320 + }
  321 + return 0;
319 322 } /* mct_u232_set_modem_ctrl */
320 323  
321 324 static int mct_u232_get_modem_stat(struct usb_serial *serial,