Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d25d5f28 authored by Bjørn Mork's avatar Bjørn Mork Committed by Greg Kroah-Hartman
Browse files

USB: qcserial: centralize probe exit path



Creating a common exit path from qcprobe to make it
easier to extend it.

Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2cf69930
Loading
Loading
Loading
Loading
+8 −9
Original line number Original line Diff line number Diff line
@@ -157,10 +157,9 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
		    usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
		    usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
			dev_dbg(dev, "QDL port found\n");
			dev_dbg(dev, "QDL port found\n");


			if (serial->interface->num_altsetting == 1) {
			if (serial->interface->num_altsetting == 1)
				retval = 0; /* Success */
				retval = 0; /* Success */
				break;
			else
			}
				altsetting = 1;
				altsetting = 1;
		}
		}
		break;
		break;
@@ -203,8 +202,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)


	default:
	default:
		dev_err(dev, "unknown number of interfaces: %d\n", nintf);
		dev_err(dev, "unknown number of interfaces: %d\n", nintf);
		kfree(data);
		retval = -ENODEV;
	}
	}


	if (altsetting >= 0) {
	if (altsetting >= 0) {
@@ -214,13 +211,15 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
				"Could not set interface, error %d\n",
				"Could not set interface, error %d\n",
				retval);
				retval);
			retval = -ENODEV;
			retval = -ENODEV;
			kfree(data);
		}
		}
	}
	}


	/* Set serial->private if not returning -ENODEV */
	/* Set serial->private if not returning error */
	if (retval != -ENODEV)
	if (retval == 0)
		usb_set_serial_data(serial, data);
		usb_set_serial_data(serial, data);
	else
		kfree(data);

	return retval;
	return retval;
}
}