esp32/machine_hw_spi: Reject invalid number of bits in constructor.

This commit adds an extra bit of parameters validation to the SPI bus
constructor on ESP32.  Passing 0 as the number of bits would trigger a
division by zero error when performing read/write operations on an SPI
bus created in such a fashion.

Fixes issue #5910.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
diff --git a/ports/esp32/machine_hw_spi.c b/ports/esp32/machine_hw_spi.c
index 4b3d392..6eb83fc 100644
--- a/ports/esp32/machine_hw_spi.c
+++ b/ports/esp32/machine_hw_spi.c
@@ -196,6 +196,10 @@
         changed = true;
     }
 
+    if (args[ARG_bits].u_int != -1 && args[ARG_bits].u_int <= 0) {
+        mp_raise_ValueError(MP_ERROR_TEXT("invalid bits"));
+    }
+
     if (args[ARG_bits].u_int != -1 && args[ARG_bits].u_int != self->bits) {
         self->bits = args[ARG_bits].u_int;
         changed = true;