Commit b283d6ba67a7b4c5914949ef1d756bf88cb3a0e4

Authored by Alexander Dahl
Committed by Michal Simek
1 parent 3911b19cac

fpga: altera: cyclon2: Check function pointer before calling

As already done for the 'pre' function, a check is added to not follow a
NULL pointer, if somebody has not assigned a 'post' function.

Signed-off-by: Alexander Dahl <ada@thorsis.com>

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

drivers/fpga/cyclon2.c
... ... @@ -183,8 +183,12 @@
183 183 else
184 184 puts("Fail.\n");
185 185 #endif
186   - (*fn->post) (cookie);
187 186  
  187 + /*
  188 + * Run the post configuration function if there is one.
  189 + */
  190 + if (*fn->post)
  191 + (*fn->post) (cookie);
188 192 } else {
189 193 printf("%s: NULL Interface function table!\n", __func__);
190 194 }