On Wed, 4 Oct 2017, Paul de Weerd wrote:
...
> which bumps dev/usb/umcs.c to revision 1.5 with commit message:
> 
> "Deactivate the device if I/O fails in attach.
> 
> Coverity CID 1453399; ok deraadt@"
> 
> reverting this makes the device work again, but since there's a
> Coverity CID attached, that's probably not the best move.  To try and
> better understand what's going on, I added some printf debugging
> around the original (revision 1.4) code:
...
> -     if (!umcs_get_reg(sc, UMCS_GPIO, &data)) {
> +     printf("%s: data before umcs_get_reg: %d\n", DEVNAME(sc), data);
> +     umcs_get_reg(sc, UMCS_GPIO, &data);
> +     printf("%s: data after umcs_get_reg: %d\n", DEVNAME(sc), data);
> +/*   if (!umcs_get_reg(sc, UMCS_GPIO, &data)) {
>               printf("%s: unable to get number of ports\n", DEVNAME(sc));
>               usbd_deactivate(sc->sc_udev);
>               return;
>       }
> +*/

This just looks like a reversed test: umcs_get_reg() returns zero on 
success and an errno value on failure, but the current code is disabling 
the device on success and continuing on failure.


Philip

Reply via email to