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

Commit fc9b6d6e authored by Ravi Aravamudhan's avatar Ravi Aravamudhan
Browse files

diag: Fix incorrect checks in diag driver



Diag driver checks for a particular error value when it tries
to read from the HSIC channel. However, there is a possibility
for HSIC driver to return any error code.

Change-Id: I9f9f2680fbb86cb7ea1eb58b472f2a9bfb150226
Signed-off-by: default avatarRavi Aravamudhan <aravamud@codeaurora.org>
parent 500bff85
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ static void diag_read_hsic_dci_work_fn(struct work_struct *work)
static void diag_hsic_read_complete_callback(void *ctxt, char *buf,
					int buf_size, int actual_size)
{
	int err = -2;
	int err = 0;
	int index = (int)ctxt;
	static DEFINE_RATELIMIT_STATE(rl, 10*HZ, 1);

@@ -310,13 +310,15 @@ static void diag_hsic_read_complete_callback(void *ctxt, char *buf,
	}

	/*
	 * If for some reason there was no HSIC data to write to the
	 * mdm channel, set up another read
	 * Actual Size is a negative error value when read complete
	 * fails. Don't queue a read in this case. Doing so will not let
	 * HSIC to goto suspend.
	 *
	 * Queue another read only when the read completes successfully
	 * and Diag is either in Memory device mode or USB is connected.
	 */
	if (err &&
		((driver->logging_mode == MEMORY_DEVICE_MODE) ||
		(diag_bridge[index].usb_connected &&
		!diag_hsic[index].hsic_suspend))) {
	if (actual_size >= 0 && (driver->logging_mode == MEMORY_DEVICE_MODE ||
				 diag_bridge[index].usb_connected)) {
		queue_work(diag_bridge[index].wq,
				 &diag_hsic[index].diag_read_hsic_work);
	}