<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">2025年1月9日 00:08,Mario Limonciello <<a href="mailto:mario.limonciello@amd.com" class="">mario.limonciello@amd.com</a>> 写道:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On 1/8/2025 02:56, Jiang Liu wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Enhance error handling in function amdgpu_pci_probe() to avoid<br class="">possible resource leakage.<br class="">Signed-off-by: Jiang Liu <<a href="mailto:gerry@linux.alibaba.com" class="">gerry@linux.alibaba.com</a>><br class="">---<br class=""> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 +++++++++---<br class=""> 1 file changed, 9 insertions(+), 3 deletions(-)<br class="">diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br class="">index 41d1b06be600..f8deca2f2696 100644<br class="">--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br class="">+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br class="">@@ -2346,16 +2346,16 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,<br class=""> <span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>msleep(5000);<br class=""> <span class="Apple-tab-span" style="white-space: pre;">  </span><span class="Apple-tab-span" style="white-space: pre;">  </span>goto retry_init;<br class=""> <span class="Apple-tab-span" style="white-space: pre;">       </span>} else if (ret) {<br class="">-<span class="Apple-tab-span" style="white-space: pre;">   </span><span class="Apple-tab-span" style="white-space: pre;">  </span>goto err_pci;<br class="">+<span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>goto unload_kms;<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">This label change looks wrong to me.  If you fail to amdgpu_driver_load_kms(), why would you amdgpu_driver_unload_kms()?</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">amdgpu_driver_load_kms() has cleanup handling already to call amdgpu_driver_unload_kms()</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div></blockquote><div>This goto is to handle failure of drm_dev_register() instead of failure of amdgpu_driver_load_kms().</div><div>Thanks,</div><div>Gerry</div><br class=""><blockquote type="cite" class=""><div class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> <span class="Apple-tab-span" style="white-space: pre;">     </span>}<br class="">   <span class="Apple-tab-span" style="white-space: pre;">  </span>ret = amdgpu_xcp_dev_register(adev, ent);<br class=""> <span class="Apple-tab-span" style="white-space: pre;">      </span>if (ret)<br class="">-<span class="Apple-tab-span" style="white-space: pre;">    </span><span class="Apple-tab-span" style="white-space: pre;">  </span>goto err_pci;<br class="">+<span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>goto unplug_drm;<br class="">   <span class="Apple-tab-span" style="white-space: pre;">   </span>ret = amdgpu_amdkfd_drm_client_create(adev);<br class=""> <span class="Apple-tab-span" style="white-space: pre;">   </span>if (ret)<br class="">-<span class="Apple-tab-span" style="white-space: pre;">    </span><span class="Apple-tab-span" style="white-space: pre;">  </span>goto err_pci;<br class="">+<span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>goto deregister_xcp;<br class="">   <span class="Apple-tab-span" style="white-space: pre;">       </span>/*<br class=""> <span class="Apple-tab-span" style="white-space: pre;">     </span><span class="Apple-converted-space"> </span>* 1. don't init fbdev on hw without DCE<br class="">@@ -2424,6 +2424,12 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,<br class="">   <span class="Apple-tab-span" style="white-space: pre;">        </span>return 0;<br class=""> +deregister_xcp:<br class="">+<span class="Apple-tab-span" style="white-space: pre;">        </span>amdgpu_xcp_dev_deregister(adev);<br class="">+unplug_drm:<br class="">+<span class="Apple-tab-span" style="white-space: pre;">   </span>drm_dev_unplug(ddev);<br class="">+unload_kms:<br class="">+<span class="Apple-tab-span" style="white-space: pre;">      </span>amdgpu_driver_unload_kms(ddev);<br class=""> err_pci:<br class=""> <span class="Apple-tab-span" style="white-space: pre;">     </span>pci_disable_device(pdev);<br class=""> <span class="Apple-tab-span" style="white-space: pre;">      </span>return ret;</blockquote></div></blockquote></div><br class=""></body></html>