Static code analysis tool reported memory leak in intel_hdcp_auth_downstream. Fixing the memory leak. Cc: Anusha Srivatsa <anusha.srivatsa@xxxxxxxxx> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@xxxxxxxxx> --- drivers/gpu/drm/i915/intel_hdcp.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index 14ca5d3057a7..ce771f6c1a5a 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -186,14 +186,18 @@ int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port, return -ENOMEM; ret = shim->read_ksv_fifo(intel_dig_port, num_downstream, ksv_fifo); - if (ret) + if (ret) { + kfree(ksv_fifo); return ret; + } /* Process V' values from the receiver */ for (i = 0; i < DRM_HDCP_V_PRIME_NUM_PARTS; i++) { ret = shim->read_v_prime_part(intel_dig_port, i, &vprime); - if (ret) + if (ret) { + kfree(ksv_fifo); return ret; + } I915_WRITE(HDCP_SHA_V_PRIME(i), vprime); } @@ -222,8 +226,10 @@ int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port, sha_text |= ksv[j] << ((sizeof(sha_text) - j - 1) * 8); ret = intel_write_sha_text(dev_priv, sha_text); - if (ret < 0) + if (ret < 0) { + kfree(ksv_fifo); return ret; + } /* Programming guide writes this every 64 bytes */ sha_idx += sizeof(sha_text); @@ -245,13 +251,18 @@ int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port, continue; ret = intel_write_sha_text(dev_priv, sha_text); - if (ret < 0) + if (ret < 0) { + kfree(ksv_fifo); return ret; + } + sha_leftovers = 0; sha_text = 0; sha_idx += sizeof(sha_text); } + kfree(ksv_fifo); + /* * We need to write BINFO/BSTATUS, and M0 now. Depending on how many * bytes are leftover from the last ksv, we might be able to fit them -- 2.9.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx