From: Alexander Dahl Date: Thu, 11 Apr 2019 12:18:50 +0200 Subject: [U-Boot] [PATCH 3/4] fpga: altera: cyclon2: Check function pointer before calling In-Reply-To: <20190411101851.13022-1-ada@thorsis.com> References: <20190411101851.13022-1-ada@thorsis.com> Message-ID: <20190411101851.13022-4-ada@thorsis.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- drivers/fpga/cyclon2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/fpga/cyclon2.c b/drivers/fpga/cyclon2.c index bd7931bbb1..c0fdf52582 100644 --- a/drivers/fpga/cyclon2.c +++ b/drivers/fpga/cyclon2.c @@ -185,8 +185,12 @@ static int CYC2_ps_load(Altera_desc *desc, const void *buf, size_t bsize) puts ("Fail.\n"); } #endif - (*fn->post) (cookie); + /* + * Run the post configuration function if there is one. + */ + if (*fn->post) + (*fn->post) (cookie); } else { printf ("%s: NULL Interface function table!\n", __FUNCTION__); } -- 2.11.0