Skip to contentSkip to conversation

drm/amd/amdgpu: Indent AMD_IS_APU properly

PATCH Applied Ernst Sjöstrand 3 participants 8 messages Jun 24, 2019 – Jun 25, 2019 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 drm/amd/amdgpu: Indent AMD_IS_APU properly

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/soc15.c:715 soc15_get_pcie_usage() warn: inconsistent indenting And a similar one in si.c.

---
 drivers/gpu/drm/amd/amdgpu/si.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/soc15.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/si.c +2 -2
index 4ff930a47e10..4b1e0c16ac41 100644
@@ -1339,8 +1339,8 @@ static void si_get_pcie_usage(struct amdgpu_device *adev, uint64_t *count0,
 	/* This reports 0 on APUs, so return to avoid writing/reading registers
 	 * that may or may not be different from their GPU counterparts
 	 */
-        if (adev->flags & AMD_IS_APU)
-                return;
+	if (adev->flags & AMD_IS_APU)
+		return;
 
 	/* Set the 2 events that we wish to watch, defined above */
 	/* Reg 40 is # received msgs, Reg 104 is # of posted requests sent */
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -2
index fa9c27d63504..1e424d918334 100644
@@ -712,8 +712,8 @@ static void soc15_get_pcie_usage(struct amdgpu_device *adev, uint64_t *count0,
 	/* This reports 0 on APUs, so return to avoid writing/reading registers
 	 * that may or may not be different from their GPU counterparts
 	 */
-	 if (adev->flags & AMD_IS_APU)
-		 return;
+	if (adev->flags & AMD_IS_APU)
+		return;
 
 	/* Set the 2 events that we wish to watch, defined above */
 	/* Reg 40 is # received msgs, Reg 104 is # of posted requests sent */
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190624151544.13934-1-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw

PATCH 2/6 drm/amd/amdgpu: Fix amdgpu_set_pp_od_clk_voltage error check

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:693 amdgpu_set_pp_od_clk_voltage() error: uninitialized symbol 'ret'.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -4
index 2f4b03b4e882..b44a390086f4 100644
@@ -686,12 +686,12 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
 		if (ret)
 			return -EINVAL;
 	} else {
-		if (adev->powerplay.pp_funcs->odn_edit_dpm_table)
+		if (adev->powerplay.pp_funcs->odn_edit_dpm_table) {
 			ret = amdgpu_dpm_odn_edit_dpm_table(adev, type,
 						parameter, parameter_size);
-
-		if (ret)
-			return -EINVAL;
+			if (ret)
+				return -EINVAL;
+		}
 
 		if (type == PP_OD_COMMIT_DPM_TABLE) {
 			if (adev->powerplay.pp_funcs->dispatch_tasks) {
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 3/6 drm/amd/amdgpu: amdgpu_hwmon_show_temp: initialize temp

In reply to a message not in the archive

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:1496 amdgpu_hwmon_show_temp() error: uninitialized symbol 'temp'.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -1
index b44a390086f4..63e6eee763bf 100644
@@ -1459,7 +1459,7 @@ static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
 	struct amdgpu_device *adev = dev_get_drvdata(dev);
 	struct drm_device *ddev = adev->ddev;
 	int channel = to_sensor_dev_attr(attr)->index;
-	int r, temp, size = sizeof(temp);
+	int r, temp = 0, size = sizeof(temp);
 
 	/* Can't get temperature when the card is off */
 	if  ((adev->flags & AMD_IS_PX) &&
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#4 lore raw

PATCH 4/6 drm/amd/amdgpu: Check stream in amdgpu_dm_commit_planes

In reply to a message not in the archive

Reported by smatch:
amdgpu_dm.c:5637 amdgpu_dm_commit_planes() error: we previously assumed 'acrtc_state->stream' could be null This seems to be checked for null pretty consistently elsewhere.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 58d7bbc5ada7..360b31a5c028 100644
@@ -5669,7 +5669,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
 	}
 
 	/* Update the planes if changed or disable if we don't have any. */
-	if (planes_count || acrtc_state->active_planes == 0) {
+	if ((planes_count || acrtc_state->active_planes == 0) &&
+		acrtc_state->stream) {
 		if (new_pcrtc_state->mode_changed) {
 			bundle->stream_update.src = acrtc_state->stream->src;
 			bundle->stream_update.dst = acrtc_state->stream->dst;
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190624151544.13934-4-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#6 lore raw

Re: [PATCH 4/6] drm/amd/amdgpu: Check stream in amdgpu_dm_commit_planes

Quoted 5 lines · Ernst Sjöstrand

Reported by smatch:
amdgpu_dm.c:5637 amdgpu_dm_commit_planes() error: we previously assumed 'acrtc_state->stream' could be null This seems to be checked for null pretty consistently elsewhere.

This is already reviewed and merged, but this NULL check is actually unnecessary. This function doesn't run in the new_crtc_state->stream is NULL.

Technically the behavior does change inside dc_commit_updates_for_stream. We don't actually deference the stream anywhere as far as I can tell, but we do an prepare/optimize bandwidth and a state swap. The missing state swap would matter here, but once again, we don't actually run this function at all.

All these checks should probably just be dropped.

Nicholas Kazlauskas

Quoted 10 lines
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 58d7bbc5ada7..360b31a5c028 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · line 5676

Quoted 9 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -5669,7 +5669,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
  	}
 
  	/* Update the planes if changed or disable if we don't have any. */
-	if (planes_count || acrtc_state->active_planes == 0) {
+	if ((planes_count || acrtc_state->active_planes == 0) &&
+		acrtc_state->stream) {
  		if (new_pcrtc_state->mode_changed) {
  			bundle->stream_update.src = acrtc_state->stream->src;
  			bundle->stream_update.dst = acrtc_state->stream->dst;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw

PATCH 5/6 drm/amd/amdgpu: Fix style issues in dcn20_resource.c

In reply to a message not in the archive

Inconsistent indentation and mixed use of brackets.

---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +5 -5
index c5ac25980f19..fa4f378efe5b 100644
@@ -2887,15 +2887,15 @@ static bool construct(
 	dc->caps.force_dp_tps4_for_cp2520 = true;
 	dc->caps.hw_3d_lut = true;
 
-	if (dc->ctx->dce_environment == DCE_ENV_PRODUCTION_DRV)
+	if (dc->ctx->dce_environment == DCE_ENV_PRODUCTION_DRV) {
 		dc->debug = debug_defaults_drv;
-	else if (dc->ctx->dce_environment == DCE_ENV_FPGA_MAXIMUS) {
-			pool->base.pipe_count = 4;
-
+	} else if (dc->ctx->dce_environment == DCE_ENV_FPGA_MAXIMUS) {
+		pool->base.pipe_count = 4;
 		pool->base.mpcc_count = pool->base.pipe_count;
 		dc->debug = debug_defaults_diags;
-	} else
+	} else {
 		dc->debug = debug_defaults_diags;
+	}
 	//dcn2.0x
 	dc->work_arounds.dedcn20_305_wa = true;
 
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#8 lore raw

PATCH 6/6 drm/amd/amdgpu: sdma_v4_0_start: initialize r

In reply to a message not in the archive

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1167 sdma_v4_0_start() error: uninitialized symbol 'r'.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
index c0b6011b4bd1..9e571ca283c3 100644
@@ -1092,7 +1092,7 @@ static int sdma_v4_0_load_microcode(struct amdgpu_device *adev)
 static int sdma_v4_0_start(struct amdgpu_device *adev)
 {
 	struct amdgpu_ring *ring;
-	int i, r;
+	int i, r = 0;
 
 	if (amdgpu_sriov_vf(adev)) {
 		sdma_v4_0_ctx_switch_enable(adev, false);
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190624151544.13934-6-ernstp-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Applied
#10 lore raw

Re: [PATCH 6/6] drm/amd/amdgpu: sdma_v4_0_start: initialize r

Applied the series. Thanks!

Alex

Quoted 25 lines · Ernst Sjöstrand

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:1167 sdma_v4_0_start() error: uninitialized symbol 'r'.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -2
index c0b6011b4bd1..9e571ca283c3 100644
@@ -1092,7 +1092,7 @@ static int sdma_v4_0_load_microcode(struct amdgpu_device *adev)
 static int sdma_v4_0_start(struct amdgpu_device *adev)
 {
        struct amdgpu_ring *ring;
-       int i, r;
+       int i, r = 0;
 
        if (amdgpu_sriov_vf(adev)) {
                sdma_v4_0_ctx_switch_enable(adev, false);
--

2.20.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx