diff mbox series

[1/3] hw/vfio/pci: fix vfio_pci_hot_reset_result trace point

Message ID 20220502094223.36384-2-yi.l.liu@intel.com (mailing list archive)
State New, archived
Headers show
Series vfio: Misc cleanups | expand

Commit Message

Yi Liu May 2, 2022, 9:42 a.m. UTC
From: Eric Auger <eric.auger@redhat.com>

Properly output the errno string.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
---
 hw/vfio/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Williamson May 2, 2022, 2:35 p.m. UTC | #1
On Mon,  2 May 2022 02:42:21 -0700
Yi Liu <yi.l.liu@intel.com> wrote:

> From: Eric Auger <eric.auger@redhat.com>
> 
> Properly output the errno string.

More explanation please, why is it broken and how does this fix it?
Thanks,

Alex
 
> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> ---
>  hw/vfio/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index 9fd9faee1d..4a66376be6 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2337,7 +2337,7 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
>      g_free(reset);
>  
>      trace_vfio_pci_hot_reset_result(vdev->vbasedev.name,
> -                                    ret ? "%m" : "Success");
> +                                    ret ? strerror(errno) : "Success");
>  
>  out:
>      /* Re-enable INTx on affected devices */
Eric Auger May 2, 2022, 2:43 p.m. UTC | #2
Hi Alex,

On 5/2/22 16:35, Alex Williamson wrote:
> On Mon,  2 May 2022 02:42:21 -0700
> Yi Liu <yi.l.liu@intel.com> wrote:
>
>> From: Eric Auger <eric.auger@redhat.com>
>>
>> Properly output the errno string.
> More explanation please, why is it broken and how does this fix it?
> Thanks,
"%m" format specifier is not interpreted by the trace infrastructure and
thus "%m" is output instead of the actual errno string. Fix it by
outputting

strerror(errno).

Thanks

Eric

>
> Alex
>  
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
>> ---
>>  hw/vfio/pci.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>> index 9fd9faee1d..4a66376be6 100644
>> --- a/hw/vfio/pci.c
>> +++ b/hw/vfio/pci.c
>> @@ -2337,7 +2337,7 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
>>      g_free(reset);
>>  
>>      trace_vfio_pci_hot_reset_result(vdev->vbasedev.name,
>> -                                    ret ? "%m" : "Success");
>> +                                    ret ? strerror(errno) : "Success");
>>  
>>  out:
>>      /* Re-enable INTx on affected devices */
diff mbox series

Patch

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 9fd9faee1d..4a66376be6 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2337,7 +2337,7 @@  static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
     g_free(reset);
 
     trace_vfio_pci_hot_reset_result(vdev->vbasedev.name,
-                                    ret ? "%m" : "Success");
+                                    ret ? strerror(errno) : "Success");
 
 out:
     /* Re-enable INTx on affected devices */