Hi!
Clearly code wants to allow at most one of them to be NULL.
- if (!snd_usb_validate_midi_desc(injd) ||
!snd_usb_validate_midi_desc(outjd))
- if (!(injd && snd_usb_validate_midi_desc(injd)) ||
return -ENODEV;!(outjd && snd_usb_validate_midi_desc(outjd)))
Yet it will return here if it is. Correct check would be
if (!(!injd || snd_usb_validate_midi_desc(injd)) ||
!(!outjd || snd_usb_validate_midi_desc(outjd)))
AFAICT.
Erm, right, but a better representation is:
if ((injd && !snd_usb_validate_midi_desc(injd)) || (outjd && !snd_usb_validate_midi_desc(injd)))
Of course, another typo:
if ((injd && !snd_usb_validate_midi_desc(injd)) || (outjd && !snd_usb_validate_midi_desc(outjd)))
Agreed, that is better. I was focusing on boolean algebra too much.
Best regards, Pavel