[libvirt PATCH 1/3] nodedev: remove unnecessary null check
Laine Stump
laine at redhat.com
Tue Apr 13 21:51:09 UTC 2021
On 4/13/21 4:49 PM, Jonathon Jongsma wrote:
> g_strdup_printf() is guaranteed to return a non-NULL value, so remove
> the unnecessary check for NULL.
>
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
> src/util/virmdev.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/src/util/virmdev.c b/src/util/virmdev.c
> index 7f4a499536..102eb2bf67 100644
> --- a/src/util/virmdev.c
> +++ b/src/util/virmdev.c
> @@ -208,9 +208,6 @@ virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr)
> g_autofree char *iommu_path = NULL;
> g_autofree char *dev_path = virMediatedDeviceGetSysfsPath(uuidstr);
>
> - if (!dev_path)
> - return NULL;
virMediatedDeviceGetSysfsPath() is called in 2 other places where the
return is checked for NULL.
As long as you're getting rid of this NULL check, how about just turning
this patch into "remove unnecessary check for NULL on return from
virMediatedDeviceGetSysfsPath"?
Reviewed-by: Laine Stump <laine at redhat.com>
either with this single change, or with all three.
> -
> iommu_path = g_strdup_printf("%s/iommu_group", dev_path);
>
> if (!virFileExists(iommu_path)) {
>
More information about the libvir-list
mailing list