This patch fixes coverity issue by avoiding use of null pointer
in taking false branch.
Coverity issue: 373360
Fixes:
437dbd2fd428 ("net/ice: support 1PPS")
Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
idx = strtoul(str, &end, 10);
if (end == NULL || idx >= ICE_MAX_PIN_NUM)
return -1;
+ while (isblank(*end))
+ end++;
+ if (*end != ']')
+ return -1;
devargs->pin_idx = idx;
devargs->pps_out_ena = 1;
- }
-
- while (isblank(*end))
- end++;
- if (*end != ']')
- return -1;
+ return 0;
+ }
- return 0;
+ return -1;
}
static int