pld/gatemate: move pointer deref after NULL check
Move pointer deref after NULL check. Found by cppcheck. Change-Id: Ifdf40046cb1b03dbe7f445660b3349deae788e7b Signed-off-by: Mark O'Donovan <shiftee@posteo.net> Reviewed-on: https://review.openocd.org/c/openocd/+/9499 Reviewed-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
This commit is contained in:
committed by
Antonio Borneo
parent
b215fe8621
commit
0e41ac862d
@@ -138,11 +138,11 @@ static int gatemate_read_cfg_file(struct gatemate_bit_file *bit_file, const char
|
|||||||
|
|
||||||
static int gatemate_read_file(struct gatemate_bit_file *bit_file, const char *filename)
|
static int gatemate_read_file(struct gatemate_bit_file *bit_file, const char *filename)
|
||||||
{
|
{
|
||||||
memset(bit_file, 0, sizeof(struct gatemate_bit_file));
|
|
||||||
|
|
||||||
if (!filename || !bit_file)
|
if (!filename || !bit_file)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
|
memset(bit_file, 0, sizeof(struct gatemate_bit_file));
|
||||||
|
|
||||||
/* check if binary .bit or ascii .cfg */
|
/* check if binary .bit or ascii .cfg */
|
||||||
const char *file_suffix_pos = strrchr(filename, '.');
|
const char *file_suffix_pos = strrchr(filename, '.');
|
||||||
if (!file_suffix_pos) {
|
if (!file_suffix_pos) {
|
||||||
|
|||||||
Reference in New Issue
Block a user