Re: [PATCH] drm/amdgpu: fix compile warnings

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

 



Am 01.03.19 um 17:43 schrieb Bhawanpreet Lakha:
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@xxxxxxx>
---
  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;
  	}
  	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);
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);

When you cast it anyway, you can drop the ULL.

  	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");

A newline between declaration and code please.

Christian.

  	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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux