diff mbox

mmc: omap_hsmmc: precedence bug in omap_hsmmc_context_restore()

Message ID 20130822125613.GB2543@elgon.mountain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Aug. 22, 2013, 12:56 p.m. UTC
'!' has higher precedence than '&' so this doesn't work as intended
although since RESETDONE is 1 it would work if none of the other bits
are set.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Untested.

--
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

Comments

Balaji T K Aug. 22, 2013, 2:46 p.m. UTC | #1
On Thursday 22 August 2013 06:26 PM, Dan Carpenter wrote:
> '!' has higher precedence than '&' so this doesn't work as intended
> although since RESETDONE is 1 it would work if none of the other bits
> are set.
>
Hi Dan,

Thanks for the patch, Indeed other bits are reserved.
however ...

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Untested.
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 1865321..7346b15 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -612,7 +612,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
>   	if (host->context_loss == context_loss)
>   		return 1;
>
> -	if (!OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE)
> +	if (!(OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE))
>   		return 1;

This check is unnecessary, will send a patch to remove this.

--
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
Dan Carpenter Jan. 30, 2014, 12:15 p.m. UTC | #2
On Thu, Aug 22, 2013 at 08:16:28PM +0530, Balaji T K wrote:
> On Thursday 22 August 2013 06:26 PM, Dan Carpenter wrote:
> >'!' has higher precedence than '&' so this doesn't work as intended
> >although since RESETDONE is 1 it would work if none of the other bits
> >are set.
> >
> Hi Dan,
> 
> Thanks for the patch, Indeed other bits are reserved.
> however ...
> 
> >Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >---
> >Untested.
> >
> >diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> >index 1865321..7346b15 100644
> >--- a/drivers/mmc/host/omap_hsmmc.c
> >+++ b/drivers/mmc/host/omap_hsmmc.c
> >@@ -612,7 +612,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
> >  	if (host->context_loss == context_loss)
> >  		return 1;
> >
> >-	if (!OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE)
> >+	if (!(OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE))
> >  		return 1;
> 
> This check is unnecessary, will send a patch to remove this.

What happened with this?

regards,
dan carpenter

--
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
Balaji T K Jan. 30, 2014, 1:04 p.m. UTC | #3
On Thursday 30 January 2014 05:45 PM, Dan Carpenter wrote:
> On Thu, Aug 22, 2013 at 08:16:28PM +0530, Balaji T K wrote:
>> On Thursday 22 August 2013 06:26 PM, Dan Carpenter wrote:
>>> '!' has higher precedence than '&' so this doesn't work as intended
>>> although since RESETDONE is 1 it would work if none of the other bits
>>> are set.
>>>
>> Hi Dan,
>>
>> Thanks for the patch, Indeed other bits are reserved.
>> however ...
>>
>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>> ---
>>> Untested.
>>>
>>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>>> index 1865321..7346b15 100644
>>> --- a/drivers/mmc/host/omap_hsmmc.c
>>> +++ b/drivers/mmc/host/omap_hsmmc.c
>>> @@ -612,7 +612,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
>>>   	if (host->context_loss == context_loss)
>>>   		return 1;
>>>
>>> -	if (!OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE)
>>> +	if (!(OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE))
>>>   		return 1;
>>
>> This check is unnecessary, will send a patch to remove this.
>
> What happened with this?

My bad, I missed it, will fix it.

Thanks and Regards,
Balaji T K
--
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/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1865321..7346b15 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -612,7 +612,7 @@  static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)
 	if (host->context_loss == context_loss)
 		return 1;
 
-	if (!OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE)
+	if (!(OMAP_HSMMC_READ(host->base, SYSSTATUS) & RESETDONE))
 		return 1;
 
 	if (host->pdata->controller_flags & OMAP_HSMMC_SUPPORTS_DUAL_VOLT) {