Module Name: src
Committed By: snj
Date: Sun Feb 11 21:29:18 UTC 2018
Modified Files:
src/sys/dev/sdmmc [netbsd-8]: sdmmc_mem.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.56.4.4 -r1.56.4.5 src/sys/dev/sdmmc/sdmmc_mem.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/sdmmc/sdmmc_mem.c
diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.56.4.4 src/sys/dev/sdmmc/sdmmc_mem.c:1.56.4.5
--- src/sys/dev/sdmmc/sdmmc_mem.c:1.56.4.4 Fri Sep 1 09:59:10 2017
+++ src/sys/dev/sdmmc/sdmmc_mem.c Sun Feb 11 21:29:18 2018
@@ -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 @@ sdmmc_mem_send_op_cond(struct sdmmc_soft
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;