All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: alexander.deucher@amd.com
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] drm/amdgpu: Add support for CIK parts
Date: Tue, 13 Dec 2016 13:34:17 +0300	[thread overview]
Message-ID: <20161213103417.GA9265@elgon.mountain> (raw)

Hello Alex Deucher,

The patch a2e73f56fa62: "drm/amdgpu: Add support for CIK parts" from
Apr 20, 2015, leads to the following static checker warning:

	drivers/gpu/drm/amd/amdgpu/ci_dpm.c:6293 ci_dpm_sw_init()
	warn: 'adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries' double freed

	drivers/gpu/drm/amd/amdgpu/ci_dpm.c:6293 ci_dpm_sw_init()
	warn: 'adev->pm.dpm.ps' double freed

drivers/gpu/drm/amd/amdgpu/ci_dpm.c
  6274  
  6275          ret = ci_dpm_init_microcode(adev);
  6276          if (ret)
  6277                  return ret;
  6278  
  6279          INIT_WORK(&adev->pm.dpm.thermal.work, amdgpu_dpm_thermal_work_handler);
  6280          mutex_lock(&adev->pm.mutex);
  6281          ret = ci_dpm_init(adev);

ci_dpm_init() has built-in calls to ci_dpm_fini().

  6282          if (ret)
  6283                  goto dpm_failed;
  6284          adev->pm.dpm.current_ps = adev->pm.dpm.requested_ps = adev->pm.dpm.boot_ps;
  6285          if (amdgpu_dpm == 1)
  6286                  amdgpu_pm_print_power_states(adev);
  6287          mutex_unlock(&adev->pm.mutex);
  6288          DRM_INFO("amdgpu: dpm initialized\n");
  6289  
  6290          return 0;
  6291  
  6292  dpm_failed:
  6293          ci_dpm_fini(adev);

Then we call it again here.  This style of error handling is a layering
violation and people think it makes the code so much simpler but it
really doesn't at all...  :/  Just have every function unwind it's own
allocations, doing it that way basically writes a mirroring de-allocate
function for every allocator for no effort.

  6294          mutex_unlock(&adev->pm.mutex);
  6295          DRM_ERROR("amdgpu: dpm initialization failed\n");
  6296          return ret;
  6297  }

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2016-12-13 10:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13 10:34 Dan Carpenter [this message]
2017-01-26  6:42 ` [bug report] drm/amdgpu: Add support for CIK parts Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161213103417.GA9265@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.