]> sigrok.org Git - libsigrok.git/commit
microchip-pickit2: silence compiler warnings (NULL dereference)
authorGerhard Sittig <redacted>
Sun, 16 Jun 2019 09:17:51 +0000 (11:17 +0200)
committerGerhard Sittig <redacted>
Sun, 21 Aug 2022 15:45:11 +0000 (17:45 +0200)
commitfbe1481a4cda038891d24679fd58e89375da17fe
treeb7004c75d60b323e4df1b0d5463bfb58186e99ea
parent5dfa77b54a45b7a767b03c4dce41ea41e62816eb
microchip-pickit2: silence compiler warnings (NULL dereference)

Check pointers for validity before dereferencing them. This silences the
following compiler warnings:

../src/hardware/microchip-pickit2/api.c:275:8: warning: Access to field 'conn' results in a dereference of a null pointer (loaded from variable 'sdi')
                if (!sdi->conn)
../src/hardware/microchip-pickit2/api.c:281:10: warning: Access to field 'samplerates' results in a dereference of a null pointer (loaded from variable 'devc')
                rate = devc->samplerates[devc->curr_samplerate_idx];
../src/hardware/microchip-pickit2/api.c:287:11: warning: Access to field 'captureratios' results in a dereference of a null pointer (loaded from variable 'devc')
                ratio = devc->captureratios[devc->curr_captureratio_idx];
src/hardware/microchip-pickit2/api.c