Reset firmware when inference cancellation fails

If an inference fails to be cancelled and it is still in a pending
state, reset the whole firmware.  Indeed the assumption is that
something is at fault on the firmware side and it is not progressing.

Change-Id: I2f568b2167d86cda3cb96a5e83551b018f5fc55d
diff --git a/kernel/ethosu_cancel_inference.c b/kernel/ethosu_cancel_inference.c
index 09778ee..befdd2f 100644
--- a/kernel/ethosu_cancel_inference.c
+++ b/kernel/ethosu_cancel_inference.c
@@ -159,6 +159,15 @@
 		goto put_kref;
 	}
 
+	/* if cancellation failed and the inference did not complete then reset
+	 * the firmware */
+	if (cancellation->uapi->status == ETHOSU_UAPI_STATUS_ERROR &&
+	    !cancellation->inf->done) {
+		ret = ethosu_firmware_reset(cancellation->edev);
+		if (ret)
+			goto put_kref;
+	}
+
 put_kref:
 	kref_put(&cancellation->kref, &ethosu_cancel_inference_destroy);