From patchwork Mon May 14 12:02:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramon Fried X-Patchwork-Id: 912897 X-Patchwork-Delegate: trini@ti.com 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="eFe/mRDs"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40kzpn3pH9z9s0q for ; Mon, 14 May 2018 22:02:40 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A19BBC21FDE; Mon, 14 May 2018 12:02:37 +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=FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID 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 2560DC21FC9; Mon, 14 May 2018 12:02:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1A39CC21FC9; Mon, 14 May 2018 12:02:34 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id B5C7AC21E60 for ; Mon, 14 May 2018 12:02:33 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id f8-v6so14706823wmc.4 for ; Mon, 14 May 2018 05:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=+NHMYzZnrG+f+1IM7Uz3b+9rYYN3ouqJ4aaKlduMSIw=; b=eFe/mRDsc6GxB4bu8oYGt0fCnS8qYulvppxLQR5F96Sy/ZLIwQCCJCv54ma0m178tR k/OacqrzHixeclElgwj6JYpAMsJiaAu2Zq2VmPUyOAVwfnTUQafXILmQp0VhS2iemXOd zNPL3wn4xM1DFWUJyekdD5qFkf/9pUFDlNtmBJW/jd9nAtItvGqTVSnWX5YMAxZRrelI JQg9Ft9YmHAyeQKxb0QFzg5XSNcif5IopWLwG6LrX6xVhErCvlLunToDjQoLx+Yk6mwN el3cRy/Wo20xe+79TraWSzhLyI+IU+e9MUJR8phsn0RrACGyRk6S7hHs42XvRdR2cTV8 oNig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+NHMYzZnrG+f+1IM7Uz3b+9rYYN3ouqJ4aaKlduMSIw=; b=XKC9eiXG9zcIMxUqvs+4pD8BDGaXGF0NpEQ9Ut2hIPKQqDpyab+AFCgM9gj5cwtdX9 TqXWLzbP3suU79QFrJBrVHPXOlmQq2V/jMSUlEPGLA77Xp2F6l7ntxGNt+DFBpsrG7zt DV6VIDPmuhR//wXqOQWsyD2d/SMBSbzvUrwBpqX5eD70fuwYTNU2+UXZx/okL7H+mDGg kfSAcniXofqerIlmR9MKKGShlMupPhXkvspU7TciY+WpmMNQzqKxMgaKlQqOUmCusoRJ o9Wnu8jTPDEBI4KycTsQimtTc0jxg7WveqFRGzojObbBBOceOWcpjJuuXaHMOZGoQ16U GFPw== X-Gm-Message-State: ALKqPwccX1elA6ic4FbqdTAMHjFfSGTqQCVEFNYBrdNpauxlvLYiof3y l235Ypq9sVm5jqDQxiYh+kY= X-Google-Smtp-Source: AB8JxZpRR+dnrBOxdr4W50/w1lnTVClB6cN2DAwa7HdVv2pdrraLeU7Hp+8Eb/TwwV1C+WzTYi5j9g== X-Received: by 2002:a1c:5ec9:: with SMTP id s192-v6mr4694510wmb.54.1526299353258; Mon, 14 May 2018 05:02:33 -0700 (PDT) Received: from localhost.localdomain ([141.226.166.38]) by smtp.gmail.com with ESMTPSA id e7-v6sm11824799wrn.88.2018.05.14.05.02.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 May 2018 05:02:32 -0700 (PDT) From: Ramon Fried To: jh80.chung@samsung.com Date: Mon, 14 May 2018 15:02:30 +0300 Message-Id: <20180514120230.3020-1-ramon.fried@gmail.com> X-Mailer: git-send-email 2.17.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] mmc: sdhci: Check that ops are defined 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" The check is necessary to avoid NULL pointer dereference. Signed-off-by: Ramon Fried Reviewed-by: Michal Simek --- drivers/mmc/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 8971a1122c..400f87e134 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -314,7 +314,7 @@ static int sdhci_execute_tuning(struct udevice *dev, uint opcode) debug("%s\n", __func__); - if (host->ops->platform_execute_tuning) { + if (host->ops && host->ops->platform_execute_tuning) { err = host->ops->platform_execute_tuning(mmc, opcode); if (err) return err; @@ -347,7 +347,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock) if (clock == 0) return 0; - if (host->ops->set_delay) + if (host->ops && host->ops->set_delay) host->ops->set_delay(host); if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {