<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Liang, Prike <Prike.Liang@amd.com><br>
<b>Sent:</b> Monday, June 8, 2020 3:34 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Liang, Prike <Prike.Liang@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu/soc15: fix nullptr issue in soc15_read_register() for reg base accessing</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">The failed case is no SDMA1 IP for Renoir discovery table while in accessing SDMA1 reg base,<br>
thus need have nullptr test for soc15_read_register invoked in MMR addres space inqure opt.<br>
<br>
Signed-off-by: Prike.Liang <Prike.Liang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++-<br>
 1 file changed, 2 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
index 623745b..3e406ee 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
@@ -415,7 +415,8 @@ static int soc15_read_register(struct amdgpu_device *adev, u32 se_num,<br>
         *value = 0;<br>
         for (i = 0; i < ARRAY_SIZE(soc15_allowed_read_registers); i++) {<br>
                 en = &soc15_allowed_read_registers[i];<br>
-               if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]<br>
+               if (adev->reg_offset[en->hwip][en->inst] &&<br>
+                       reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]<br>
                                         + en->reg_offset))<br>
                         continue;<br>
 <br>
-- <br>
2.7.4<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>