diff mbox

mmc: mxcmmc: check the return value of mxcmci_finish_data

Message ID 1499328552-83340-1-git-send-email-shawn.lin@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Lin July 6, 2017, 8:09 a.m. UTC
We got a compile warning for mxcmmc,

drivers/mmc/host/mxcmmc.c: In function 'mxcmci_data_done':
drivers/mmc/host/mxcmmc.c:661:6: warning: variable 'data_error' set but
not used [-Wunused-but-set-variable]

The easiest method is to remove the data_error. But looking into
the code closely, I think we should check the return value of
mxcmci_finish_data as if it got data->error(the same as data_error),
we shouldn't try to read the response.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/mmc/host/mxcmmc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ulf Hansson July 11, 2017, 2:44 p.m. UTC | #1
On 6 July 2017 at 10:09, Shawn Lin <shawn.lin@rock-chips.com> wrote:
> We got a compile warning for mxcmmc,
>
> drivers/mmc/host/mxcmmc.c: In function 'mxcmci_data_done':
> drivers/mmc/host/mxcmmc.c:661:6: warning: variable 'data_error' set but
> not used [-Wunused-but-set-variable]
>
> The easiest method is to remove the data_error. But looking into
> the code closely, I think we should check the return value of
> mxcmci_finish_data as if it got data->error(the same as data_error),
> we shouldn't try to read the response.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Thanks, applied for next!

Kind regards
Uffe

> ---
>
>  drivers/mmc/host/mxcmmc.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
> index fb3ca82..3814942 100644
> --- a/drivers/mmc/host/mxcmmc.c
> +++ b/drivers/mmc/host/mxcmmc.c
> @@ -681,6 +681,9 @@ static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat)
>
>         spin_unlock_irqrestore(&host->lock, flags);
>
> +       if (data_error)
> +               return;
> +
>         mxcmci_read_response(host, stat);
>         host->cmd = NULL;
>
> --
> 1.9.1
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index fb3ca82..3814942 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -681,6 +681,9 @@  static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat)
 
 	spin_unlock_irqrestore(&host->lock, flags);
 
+	if (data_error)
+		return;
+
 	mxcmci_read_response(host, stat);
 	host->cmd = NULL;