move serial validation to the beginning

parent cd90b364
......@@ -38,8 +38,13 @@ int oau_factory_program_eeprom(unsigned int bus, unsigned int dev, char *serial)
static char ser[64];
char *ptr;
struct ftdi_context *ctx;
long s;
long serno;
serno = strtol(serial, &ptr, 10);
if (*ptr != 0 || *serial == 0) {
fprintf(stderr, "invalid serial %s\n", serial);
return -EINVAL;
}
if ((ctx = ftdi_new()) == NULL) {
fprintf(stderr, "cannot init libftdi, exiting\n");
return -ENOMEM;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment