Skip to content
Snippets Groups Projects
Commit bf9c4d14 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Jaehoon Chung
Browse files

mmc: sdhci: fix NULL pointer access when host->ops is not set


Until recently, sdhci_ops was used only for overriding IO accessors.
(so, host->ops was not set by any drivers except bcm2835_sdhci.c)

Now, we have more optional callbacks, get_cd, set_control_reg, and
set_clock.  However, the code

    if (host->ops->get_cd)
            host->ops->get_cd(host);

... expects host->ops is set for all drivers.

Commit 5e96217f ("mmc: pic32_sdhci: move the code to
pic32_sdhci.c") and commit 62226b68 ("mmc: sdhci: move the
callback function into sdhci_ops") added sdhci_ops for pic32_sdhci.c
and s5p_sdhci.c, but the other drivers still do not (need not) set
host->ops because all callbacks in sdhci_ops are optional.

host->ops must be checked to avoid the system crash caused by NULL
pointer access.

Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 4386feb7
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment