[PATCH] staging: emxx_udc: Do not use comparisons on bool tests

Roberta Dobrescu roberta.dobrescu at gmail.com
Tue Sep 23 11:00:43 EEST 2014


On 23.09.2014 10:57, Daniel Baluta wrote:
> On Tue, Sep 23, 2014 at 2:08 AM, Roberta Dobrescu
> <roberta.dobrescu at gmail.com> wrote:
>> This fixes the following coccinelle warning:
>> WARNING: Comparison of bool to 0/1
>>
>> Signed-off-by: Roberta Dobrescu <roberta.dobrescu at gmail.com>
>> ---
>>  drivers/staging/emxx_udc/emxx_udc.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
>> index 341b652..81038aa 100644
>> --- a/drivers/staging/emxx_udc/emxx_udc.c
>> +++ b/drivers/staging/emxx_udc/emxx_udc.c
>> @@ -2009,8 +2009,7 @@ static inline void _nbu2ss_epn_in_int(
>>                 result = _nbu2ss_epn_in_transfer(udc, ep, req);
>>
>>         } else {
>> -               if ((req->zero != 0)
>> -               && ((req->req.actual % ep->ep.maxpacket) == 0)) {
>> +               if (req->zero && ((req->req.actual % ep->ep.maxpacket) == 0)) {
>>
>>                         status =
>>                         _nbu2ss_readl(&preg->EP_REGS[ep->epnum-1].EP_STATUS);
>> @@ -2097,8 +2096,7 @@ static inline void _nbu2ss_epn_out_dma_int(
>>         num = ep->epnum - 1;
>>
>>         if (req->req.actual == req->req.length) {
>> -               if ((req->req.length % ep->ep.maxpacket)
>> -                               && (req->zero == 0)) {
>> +               if ((req->req.length % ep->ep.maxpacket) && req->zero) {
> 
> Oh wait! Shouldn't it be !req->zero?
> 
Oops, you`re right. Thanks.


More information about the firefly mailing list