]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/mmc/host/tmio_mmc_pio.c
mmc: tmio: prevent endless loop in tmio_mmc_set_clock()
[karo-tx-linux.git] / drivers / mmc / host / tmio_mmc_pio.c
index 692e578cf4d71b306404efeb7f733195b00a1697..e487ba4bb01a746f384dba0ed9fce9f8dda4fc16 100644 (file)
@@ -1121,6 +1121,15 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
                mmc->f_min = mmc->f_max / 512;
        }
 
+       /*
+        * Check the sanity of mmc->f_min to prevent tmio_mmc_set_clock() from
+        * looping forever...
+        */
+       if (mmc->f_min == 0) {
+               ret = -EINVAL;
+               goto host_free;
+       }
+
        /*
         * While using internal tmio hardware logic for card detection, we need
         * to ensure it stays powered for it to work.