From: Ramon Fried <ramon.fried@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mmc: sdhci: Check that ops are defined
Date: Mon, 14 May 2018 15:02:30 +0300 [thread overview]
Message-ID: <20180514120230.3020-1-ramon.fried@gmail.com> (raw)
The check is necessary to avoid NULL pointer dereference.
Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
---
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) {
--
2.17.0
next reply other threads:[~2018-05-14 12:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-14 12:02 Ramon Fried [this message]
2018-05-14 13:28 ` [U-Boot] [PATCH] mmc: sdhci: Check that ops are defined Michal Simek
2018-05-15 12:28 ` [U-Boot] " Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180514120230.3020-1-ramon.fried@gmail.com \
--to=ramon.fried@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox