MMC: meson: avoid possible NULL dereference
No actual segmentation faults were observed but the coding is
at least inconsistent.
irqreturn_t meson_mmc_irq():
We should not dereference host before checking it.
meson_mmc_irq_thread():
If cmd or mrq are NULL we should not dereference them after
writing a warning.
Fixes: 51c5d8447b
MMC: meson: initial support for GX platforms
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
a121103c92
commit
19a91dd4e3
|
@ -578,13 +578,15 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
struct meson_host *host = dev_id;
|
struct meson_host *host = dev_id;
|
||||||
struct mmc_request *mrq;
|
struct mmc_request *mrq;
|
||||||
struct mmc_command *cmd = host->cmd;
|
struct mmc_command *cmd;
|
||||||
u32 irq_en, status, raw_status;
|
u32 irq_en, status, raw_status;
|
||||||
irqreturn_t ret = IRQ_HANDLED;
|
irqreturn_t ret = IRQ_HANDLED;
|
||||||
|
|
||||||
if (WARN_ON(!host))
|
if (WARN_ON(!host))
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
||||||
|
cmd = host->cmd;
|
||||||
|
|
||||||
mrq = host->mrq;
|
mrq = host->mrq;
|
||||||
|
|
||||||
if (WARN_ON(!mrq))
|
if (WARN_ON(!mrq))
|
||||||
|
@ -670,10 +672,10 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)
|
||||||
int ret = IRQ_HANDLED;
|
int ret = IRQ_HANDLED;
|
||||||
|
|
||||||
if (WARN_ON(!mrq))
|
if (WARN_ON(!mrq))
|
||||||
ret = IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
||||||
if (WARN_ON(!cmd))
|
if (WARN_ON(!cmd))
|
||||||
ret = IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
||||||
data = cmd->data;
|
data = cmd->data;
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
Loading…
Reference in New Issue