check spelling (#720)

Use misspell-fixer if available, and correct the small number of errors
it found. Rather than trying to install into the CI, run it directly from a
github action.

Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 8f40025..3b99a28 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -51,3 +51,10 @@
               diffutils valgrind python3-pytest python3-flake8 which \
               meson ninja-build
           ./.github/workflows/pull_request.sh
+  spelling:
+    runs-on: ubuntu-latest
+    container: vlajos/misspell-fixer
+    steps:
+      - uses: actions/checkout@v2
+      - name: run misspell-fixer
+        run: /misspell-fixer/misspell-fixer -sv .
diff --git a/README.md b/README.md
index c43bdd4..d61412c 100644
--- a/README.md
+++ b/README.md
@@ -171,7 +171,7 @@
 [Client](./samples/client.c) implements a client that knows how to drive this
 particular device (that would normally be QEMU + guest VM + kernel driver).
 
-The client excercises all commands in the vfio-user protocol, and then proceeds
+The client exercises all commands in the vfio-user protocol, and then proceeds
 to perform live migration. The client spawns the destination server (this would
 be normally done by libvirt) and then migrates the device state, before
 switching entirely to the destination server. We re-use the source client
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c
index 372ef2e..93dca6d 100644
--- a/lib/libvfio-user.c
+++ b/lib/libvfio-user.c
@@ -1732,7 +1732,7 @@
 
     /*
      * FIXME: Now we always allocate for migration region. Check if its better
-     * to seperate migration region from standard regions in vfu_ctx.reg_info
+     * to separate migration region from standard regions in vfu_ctx.reg_info
      * and move it into vfu_ctx.migration.
      */
     vfu_ctx->nr_regions = VFU_PCI_DEV_NUM_REGIONS;
diff --git a/meson.build b/meson.build
index bc0de78..b54dede 100644
--- a/meson.build
+++ b/meson.build
@@ -44,6 +44,7 @@
 
 pytest = find_program('pytest-3', required: false)
 flake8 = find_program('flake8', required: false)
+misspell_fixer = find_program('misspell-fixer', required: false)
 rstlint = find_program('restructuredtext-lint', required: false)
 valgrind = find_program('valgrind', required: false)
 
diff --git a/samples/client.c b/samples/client.c
index 13f5ad1..d4abd21 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -1129,7 +1129,7 @@
     /*
      * VFIO_USER_VERSION
      *
-     * Do intial negotiation with the server, and discover parameters.
+     * Do initial negotiation with the server, and discover parameters.
      */
     negotiate(sock, &server_max_fds, &server_max_data_xfer_size, &pgsize);
 
diff --git a/test/meson.build b/test/meson.build
index dd48e4d..c0e61b2 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -98,4 +98,15 @@
     )
 endif
 
+if misspell_fixer.found()
+    test(
+        'misspell_fixer',
+        misspell_fixer,
+        suite: 'style',
+        args: [
+            '-sv',
+            meson.source_root(),
+        ])
+endif
+
 subdir('py')