Commit 9b980d95 authored by tcharding's avatar tcharding Committed by Ulf Hansson

mmc: core: guard dereference of optional parameter

Various functions take as parameter an optional pointer. Pointer
should be guarded with non-NULL check before dereferencing.

Add non-NULL check before dereference of pointer.
Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent ce473d5b
...@@ -373,6 +373,7 @@ u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret) ...@@ -373,6 +373,7 @@ u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret)
u8 val; u8 val;
if (!func) { if (!func) {
if (err_ret)
*err_ret = -EINVAL; *err_ret = -EINVAL;
return 0xFF; return 0xFF;
} }
...@@ -407,6 +408,7 @@ void sdio_writeb(struct sdio_func *func, u8 b, unsigned int addr, int *err_ret) ...@@ -407,6 +408,7 @@ void sdio_writeb(struct sdio_func *func, u8 b, unsigned int addr, int *err_ret)
int ret; int ret;
if (!func) { if (!func) {
if (err_ret)
*err_ret = -EINVAL; *err_ret = -EINVAL;
return; return;
} }
...@@ -635,6 +637,7 @@ unsigned char sdio_f0_readb(struct sdio_func *func, unsigned int addr, ...@@ -635,6 +637,7 @@ unsigned char sdio_f0_readb(struct sdio_func *func, unsigned int addr,
unsigned char val; unsigned char val;
if (!func) { if (!func) {
if (err_ret)
*err_ret = -EINVAL; *err_ret = -EINVAL;
return 0xFF; return 0xFF;
} }
...@@ -673,6 +676,7 @@ void sdio_f0_writeb(struct sdio_func *func, unsigned char b, unsigned int addr, ...@@ -673,6 +676,7 @@ void sdio_f0_writeb(struct sdio_func *func, unsigned char b, unsigned int addr,
int ret; int ret;
if (!func) { if (!func) {
if (err_ret)
*err_ret = -EINVAL; *err_ret = -EINVAL;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment