Re: [PATCH v4 1/2] radeon: fix coding issues reported from sparse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Applied.  Thanks!

Alex

On Fri, Jun 4, 2021 at 7:53 AM Chen Li <chenli@xxxxxxxxxxxxx> wrote:
>
>
> Also fix some coding issues reported from sparse.
>
> Signed-off-by: Chen Li <chenli@xxxxxxxxxxxxx>
> Acked-by: Christian König <christian.koenig@xxxxxxx>
> ---
>  drivers/gpu/drm/radeon/radeon_uvd.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
> index dfa9fdbe98da..85a1f2c31749 100644
> --- a/drivers/gpu/drm/radeon/radeon_uvd.c
> +++ b/drivers/gpu/drm/radeon/radeon_uvd.c
> @@ -152,9 +152,11 @@ int radeon_uvd_init(struct radeon_device *rdev)
>
>                         rdev->uvd.fw_header_present = true;
>
> -                       family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
> -                       version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
> -                       version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
> +                       family_id = (__force u32)(hdr->ucode_version) & 0xff;
> +                       version_major = (le32_to_cpu((__force __le32)(hdr->ucode_version))
> +                                                        >> 24) & 0xff;
> +                       version_minor = (le32_to_cpu((__force __le32)(hdr->ucode_version))
> +                                                        >> 8) & 0xff;
>                         DRM_INFO("Found UVD firmware Version: %u.%u Family ID: %u\n",
>                                  version_major, version_minor, family_id);
>
> @@ -791,17 +793,17 @@ int radeon_uvd_get_create_msg(struct radeon_device *rdev, int ring,
>                 return r;
>
>         /* stitch together an UVD create msg */
> -       writel(cpu_to_le32(0x00000de4), &msg[0]);
> +       writel((__force u32)cpu_to_le32(0x00000de4), &msg[0]);
>         writel(0x0, (void __iomem *)&msg[1]);
> -       writel(cpu_to_le32(handle), &msg[2]);
> +       writel((__force u32)cpu_to_le32(handle), &msg[2]);
>         writel(0x0, &msg[3]);
>         writel(0x0, &msg[4]);
>         writel(0x0, &msg[5]);
>         writel(0x0, &msg[6]);
> -       writel(cpu_to_le32(0x00000780), &msg[7]);
> -       writel(cpu_to_le32(0x00000440), &msg[8]);
> +       writel((__force u32)cpu_to_le32(0x00000780), &msg[7]);
> +       writel((__force u32)cpu_to_le32(0x00000440), &msg[8]);
>         writel(0x0, &msg[9]);
> -       writel(cpu_to_le32(0x01b37000), &msg[10]);
> +       writel((__force u32)cpu_to_le32(0x01b37000), &msg[10]);
>         for (i = 11; i < 1024; ++i)
>                 writel(0x0, &msg[i]);
>
> @@ -827,9 +829,9 @@ int radeon_uvd_get_destroy_msg(struct radeon_device *rdev, int ring,
>                 return r;
>
>         /* stitch together an UVD destroy msg */
> -       writel(cpu_to_le32(0x00000de4), &msg[0]);
> -       writel(cpu_to_le32(0x00000002), &msg[1]);
> -       writel(cpu_to_le32(handle), &msg[2]);
> +       writel((__force u32)cpu_to_le32(0x00000de4), &msg[0]);
> +       writel((__force u32)cpu_to_le32(0x00000002), &msg[1]);
> +       writel((__force u32)cpu_to_le32(handle), &msg[2]);
>         writel(0x0, &msg[3]);
>         for (i = 4; i < 1024; ++i)
>                 writel(0x0, &msg[i]);
> --
> 2.31.1
>
>
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux