[edk2] [platforms: PATCH 02/10] Marvell/Drivers: MvI2cDxe: Fix returning status in MvI2cStartRequest

Marcin Wojtas posted 10 patches 7 years, 6 months ago
There is a newer version of this series
[edk2] [platforms: PATCH 02/10] Marvell/Drivers: MvI2cDxe: Fix returning status in MvI2cStartRequest
Posted by Marcin Wojtas 7 years, 6 months ago
In MvI2cStartRequest the status was assigned to the variable
without dereferencing a pointer. Fix it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
index 7faf1f7..8ed96f0 100755
--- a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
+++ b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
@@ -631,7 +631,7 @@ MvI2cStartRequest (
   }
 
   if (I2cStatus != NULL)
-    I2cStatus = EFI_SUCCESS;
+    *I2cStatus = Status;
   if (Event != NULL)
     gBS->SignalEvent(Event);
   return EFI_SUCCESS;
-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH 02/10] Marvell/Drivers: MvI2cDxe: Fix returning status in MvI2cStartRequest
Posted by Leif Lindholm 7 years, 6 months ago
On Thu, Oct 26, 2017 at 03:19:29AM +0200, Marcin Wojtas wrote:
> In MvI2cStartRequest the status was assigned to the variable
> without dereferencing a pointer. Fix it.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> ---
>  Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> index 7faf1f7..8ed96f0 100755
> --- a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> +++ b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> @@ -631,7 +631,7 @@ MvI2cStartRequest (
>    }
>  
>    if (I2cStatus != NULL)
> -    I2cStatus = EFI_SUCCESS;
> +    *I2cStatus = Status;

Oh, that's horrible! And only did not generate warnings because
EFI_SUCCESS is 0.

However, you also change from setting *I2cStatus to Status instead of
EFI_SUCCESS. This should be mentioned in commit message.

/
    Leif

>    if (Event != NULL)
>      gBS->SignalEvent(Event);
>    return EFI_SUCCESS;
> -- 
> 2.7.4
> 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH 02/10] Marvell/Drivers: MvI2cDxe: Fix returning status in MvI2cStartRequest
Posted by Marcin Wojtas 7 years, 6 months ago
2017-10-26 15:11 GMT+02:00 Leif Lindholm <leif.lindholm@linaro.org>:
> On Thu, Oct 26, 2017 at 03:19:29AM +0200, Marcin Wojtas wrote:
>> In MvI2cStartRequest the status was assigned to the variable
>> without dereferencing a pointer. Fix it.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
>> ---
>>  Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
>> index 7faf1f7..8ed96f0 100755
>> --- a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
>> +++ b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
>> @@ -631,7 +631,7 @@ MvI2cStartRequest (
>>    }
>>
>>    if (I2cStatus != NULL)
>> -    I2cStatus = EFI_SUCCESS;
>> +    *I2cStatus = Status;
>
> Oh, that's horrible! And only did not generate warnings because
> EFI_SUCCESS is 0.

This parameter is 'optional', so me must have been also lucky not to
use it in basic operation.

>
> However, you also change from setting *I2cStatus to Status instead of
> EFI_SUCCESS. This should be mentioned in commit message.
>
> /

We can leave EFI_SUCCESS, as it's the only option at this place. It
was changed to Status, due to first patch of the series. I will leave
the original and just modify *.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [platforms: PATCH 02/10] Marvell/Drivers: MvI2cDxe: Fix returning status in MvI2cStartRequest
Posted by Leif Lindholm 7 years, 6 months ago
On Thu, Oct 26, 2017 at 03:22:32PM +0200, Marcin Wojtas wrote:
> 2017-10-26 15:11 GMT+02:00 Leif Lindholm <leif.lindholm@linaro.org>:
> > On Thu, Oct 26, 2017 at 03:19:29AM +0200, Marcin Wojtas wrote:
> >> In MvI2cStartRequest the status was assigned to the variable
> >> without dereferencing a pointer. Fix it.
> >>
> >> Contributed-under: TianoCore Contribution Agreement 1.1
> >> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> >> ---
> >>  Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> >> index 7faf1f7..8ed96f0 100755
> >> --- a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> >> +++ b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> >> @@ -631,7 +631,7 @@ MvI2cStartRequest (
> >>    }
> >>
> >>    if (I2cStatus != NULL)
> >> -    I2cStatus = EFI_SUCCESS;
> >> +    *I2cStatus = Status;
> >
> > Oh, that's horrible! And only did not generate warnings because
> > EFI_SUCCESS is 0.
> 
> This parameter is 'optional', so me must have been also lucky not to
> use it in basic operation.
> 
> >
> > However, you also change from setting *I2cStatus to Status instead of
> > EFI_SUCCESS. This should be mentioned in commit message.
> >
> > /
> 
> We can leave EFI_SUCCESS, as it's the only option at this place. It
> was changed to Status, due to first patch of the series. I will leave
> the original and just modify *.

Yes, that works too - thanks!

/
    Leif
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel