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

Commit 2bb25ecd authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Check if usb is connected before usb_diag_write()"

parents ba8b292d 9077d704
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -284,11 +284,6 @@ int diag_usb_write(int id, unsigned char *buf, int len, int ctxt)
	}

	usb_info = &diag_usb[id];
	if (!usb_info->hdl || !usb_info->connected) {
		pr_debug_ratelimited("diag: USB ch %s is not connected\n",
				     usb_info->name);
		return -ENODEV;
	}

	req = diagmem_alloc(driver, sizeof(struct diag_request),
			    usb_info->mempool);
@@ -308,6 +303,12 @@ int diag_usb_write(int id, unsigned char *buf, int len, int ctxt)
	req->length = len;
	req->context = (void *)(uintptr_t)ctxt;

	if (!usb_info->hdl || !usb_info->connected) {
		pr_debug_ratelimited("diag: USB ch %s is not connected\n",
				     usb_info->name);
		diagmem_free(driver, req, usb_info->mempool);
		return -ENODEV;
	}
	err = usb_diag_write(usb_info->hdl, req);
	if (err) {
		pr_err_ratelimited("diag: In %s, error writing to usb channel %s, err: %d\n",