From patchwork Thu Apr 11 10:18:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Dahl X-Patchwork-Id: 1083816 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=thorsis.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44fxqn5X1Cz9sB3 for ; Thu, 11 Apr 2019 20:20:37 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1D2B4C21DFB; Thu, 11 Apr 2019 10:20:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8DCB0C21E1A; Thu, 11 Apr 2019 10:19:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B245DC21C2F; Thu, 11 Apr 2019 10:19:00 +0000 (UTC) Received: from mail.thorsis.com (mail.thorsis.com [92.198.35.195]) by lists.denx.de (Postfix) with ESMTPS id C205DC21C3F for ; Thu, 11 Apr 2019 10:18:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.thorsis.com (Postfix) with ESMTP id 61A413AE2 for ; Thu, 11 Apr 2019 12:19:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.thorsis.com Received: from mail.thorsis.com ([127.0.0.1]) by localhost (mail.thorsis.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8CyBv9_J_mER for ; Thu, 11 Apr 2019 12:19:57 +0200 (CEST) Received: by mail.thorsis.com (Postfix, from userid 109) id C0AC83D2C; Thu, 11 Apr 2019 12:19:52 +0200 (CEST) Received: from adahl by ada.ifak-system.com with local (Exim 4.89) (envelope-from ) id 1hEWnD-0003Oq-5z; Thu, 11 Apr 2019 12:18:51 +0200 From: Alexander Dahl To: u-boot@lists.denx.de Date: Thu, 11 Apr 2019 12:18:50 +0200 Message-Id: <20190411101851.13022-4-ada@thorsis.com> In-Reply-To: <20190411101851.13022-1-ada@thorsis.com> References: <20190411101851.13022-1-ada@thorsis.com> Cc: Michal Simek Subject: [U-Boot] [PATCH 3/4] fpga: altera: cyclon2: Check function pointer before calling X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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__); }