Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/dev/sdmmc Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/0bbbc270d67c
branches:  netbsd-8
changeset: 434622:0bbbc270d67c
user:      snj <snj%NetBSD.org@localhost>
date:      Sun Feb 11 21:29:18 2018 +0000

description:
Pull up following revision(s) (requested by bouyer in ticket #537):
        sys/dev/sdmmc/sdmmc_mem.c: revision 1.64
Fix uninitialized variable use:
if there is an error, or if we are using a SPI controller,
sdmmc_mem_send_op_cond() doens't assign a value to *ocrp,
but it is used unconditionally in sdmmc_mem_enable() to see if we can switch
to low voltage.
In sdmmc_mem_send_op_cond(), if the new ocr is not returned by the
card for whatever reason, set *ocrp to the orig value.

diffstat:

 sys/dev/sdmmc/sdmmc_mem.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (37 lines):

diff -r 2aec4a40a0a2 -r 0bbbc270d67c sys/dev/sdmmc/sdmmc_mem.c
--- a/sys/dev/sdmmc/sdmmc_mem.c Sun Feb 11 21:17:33 2018 +0000
+++ b/sys/dev/sdmmc/sdmmc_mem.c Sun Feb 11 21:29:18 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sdmmc_mem.c,v 1.56.4.4 2017/09/01 09:59:10 martin Exp $        */
+/*     $NetBSD: sdmmc_mem.c,v 1.56.4.5 2018/02/11 21:29:18 snj Exp $   */
 /*     $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $      */
 
 /*
@@ -45,7 +45,7 @@
 /* Routines for SD/MMC memory cards. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.56.4.4 2017/09/01 09:59:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.56.4.5 2018/02/11 21:29:18 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -644,10 +644,14 @@
                error = ETIMEDOUT;
                sdmmc_delay(10000);
        }
-       if (error == 0 &&
-           ocrp != NULL &&
-           !ISSET(sc->sc_caps, SMC_CAPS_SPI_MODE))
-               *ocrp = MMC_R3(cmd.c_resp);
+       if (ocrp != NULL) {
+               if (error == 0 &&
+                   !ISSET(sc->sc_caps, SMC_CAPS_SPI_MODE)) {
+                       *ocrp = MMC_R3(cmd.c_resp);
+               } else {
+                       *ocrp = ocr;
+               }
+       }
        DPRINTF(("%s: sdmmc_mem_send_op_cond: error=%d, ocr=%#x\n",
            SDMMCDEVNAME(sc), error, MMC_R3(cmd.c_resp)));
        return error;



Home | Main Index | Thread Index | Old Index