OSDN Git Service

mmc: sdhci-pci: Fix possibility of chip->fixes being null
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 21 Jan 2014 07:52:39 +0000 (09:52 +0200)
committerChris Ball <chris@printf.net>
Thu, 23 Jan 2014 15:52:53 +0000 (10:52 -0500)
It is possible for chip->fixes to be null.  Check before dereferencing it.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable <stable@vger.kernel.org> # 3.11+
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/host/sdhci-pci.c

index 92e6e81..0955777 100644 (file)
@@ -1378,7 +1378,8 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
         * from runtime suspend.  If it is not there, don't allow runtime PM.
         * Note sdhci_pci_add_own_cd() sets slot->cd_gpio to -EINVAL on failure.
         */
-       if (chip->fixes->own_cd_for_runtime_pm && !gpio_is_valid(slot->cd_gpio))
+       if (chip->fixes && chip->fixes->own_cd_for_runtime_pm &&
+           !gpio_is_valid(slot->cd_gpio))
                chip->allow_runtime_pm = false;
 
        return slot;