[PATCH] drm/amdgpu: fix compile warnings
Wentland, Harry
Harry.Wentland at amd.com
Fri Mar 1 16:47:56 UTC 2019
On 2019-03-01 11:46 a.m., Wentland, Harry wrote:
> On 2019-03-01 11:43 a.m., Bhawanpreet Lakha wrote:
>> Fixes the warnings below
>>
>> warning: ‘ta_hdr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>> warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
>> warning: unused variable ‘ras_cmd’ [-Wunused-variable]
>> warning: comparison of distinct pointer types lacks a cast
>> Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>
>
> If these are all based on the one RAS patch please leave a Fixes: tag with that patch.
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
>> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 1 -
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 4 ++--
>> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +-
>> drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +-
>> 5 files changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> index 933822eb1227..0bbbc7cd2bea 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> @@ -927,7 +927,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
>> if (!ras)
>> return -EINVAL;
>> return copy_to_user(out, &ras->features,
>> - min(size, sizeof(ras->features))) ? -EFAULT : 0;
>> + min((size_t)size, sizeof(ras->features))) ? -EFAULT : 0;
>
> shouldn't need the 2nd size_t case (on sizeof)
whoops, copy-pasted the comment from an earlier iteration. just ignore.
Harry
>
>> }
>> default:
>> DRM_DEBUG_KMS("Invalid request %d\n", info->query);
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>> index 607c696db56b..7e3e1d588d74 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
>> @@ -654,7 +654,6 @@ static int psp_ras_terminate(struct psp_context *psp)
>>
>> static int psp_ras_initialize(struct psp_context *psp)
>> {
>> - struct ta_ras_shared_memory *ras_cmd;
>> int ret;
>>
>> if (!psp->ras.ras_initialized) {
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
>> index 604762263221..29552e39816c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
>> @@ -142,7 +142,7 @@ static ssize_t amdgpu_ras_debugfs_read(struct file *f, char __user *buf,
>> return 0;
>>
>> s -= *pos;
>> - s = min(s, size);
>> + s = min((size_t)s, size);
>
> size is already size_t, no need to cast that again
>
> With those fixed this patch is
> Reviewed-by: Harry Wentland <harry.wentland at amd.com>
>
> Harry
>
>>
>> if (copy_to_user(buf, &val[*pos], s))
>> return -EINVAL;
>> @@ -159,7 +159,7 @@ static ssize_t amdgpu_ras_debugfs_write(struct file *f, const char __user *buf,
>> struct ras_inject_if info = {
>> .head = obj->head,
>> };
>> - ssize_t s = min(64ULL, size);
>> + ssize_t s = min((size_t)64ULL, size);
>> char val[64];
>> char *str = val;
>> memset(val, 0, sizeof(val));
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>> index e1d3bef5a60c..88c45f990f05 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
>> @@ -4813,11 +4813,11 @@ static int gfx_v9_0_cp_ecc_error_irq(struct amdgpu_device *adev,
>> struct amdgpu_irq_src *source,
>> struct amdgpu_iv_entry *entry)
>> {
>> - DRM_ERROR("CP ECC ERROR IRQ\n");
>> struct ras_dispatch_if ih_data = {
>> .head = *adev->gfx.ras_if,
>> .entry = entry,
>> };
>> + DRM_ERROR("CP ECC ERROR IRQ\n");
>> amdgpu_ras_interrupt_dispatch(adev, &ih_data);
>> return 0;
>> }
>> diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
>> index 8f694968c0ad..2f6f82d13cc8 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
>> @@ -48,7 +48,7 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)
>> int err = 0;
>> const struct psp_firmware_header_v1_0 *sos_hdr;
>> const struct psp_firmware_header_v1_0 *asd_hdr;
>> - const struct ta_firmware_header_v1_0 *ta_hdr;
>> + const struct ta_firmware_header_v1_0 *ta_hdr = NULL;
>>
>> DRM_DEBUG("\n");
>>
>>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
More information about the amd-gfx
mailing list