From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDE9CECAAA1 for ; Tue, 30 Aug 2022 21:23:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DDF010E0BB; Tue, 30 Aug 2022 21:23:42 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id D544B10E0BB for ; Tue, 30 Aug 2022 21:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661894618; x=1693430618; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=PkqX568Gxxdees63w7Z9BzxI+7yxvHUhxstTVXye+i8=; b=BbsLhWh8mUGM1uoExqOFBb5If+1pdiup4S9HzzCE+2p4MeeaDWKnsqtM ou6YJp0g7fPsFDoNx6soQiBhcFY5KVmYvi+rdq6GnAPdYFsIs8l+a1fs2 xSCM1Q7CNB8aR4Y/vfkt1yOawOjvW6j4g45bmg1jzWt/S1dcwFklrANAP VS+mWl2K8FsZEnP2e4Bgm8dRvOqTkyAhURBKoy6DIVUBaYzjGHwWC4ExP LEhZ3xBFxLx1NUEEw3X+W816x7ZIMEh47p7hprqORrPvl3Mbkat38vPgO 4gyZtHB7WKO+pw0eyiq1Vm7xUDL5pFwRONOLEG6orhrYn9FZukUR7PX3h A==; X-IronPort-AV: E=McAfee;i="6500,9779,10455"; a="296088055" X-IronPort-AV: E=Sophos;i="5.93,276,1654585200"; d="scan'208";a="296088055" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 14:23:30 -0700 X-IronPort-AV: E=Sophos;i="5.93,276,1654585200"; d="scan'208";a="701145797" Received: from adixit-mobl.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.252.128.174]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 14:23:29 -0700 Date: Tue, 30 Aug 2022 14:23:28 -0700 Message-ID: <877d2pzar3.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Rodrigo Vivi In-Reply-To: <20220830193537.52201-1-rodrigo.vivi@intel.com> References: <87fshdzr3w.wl-ashutosh.dixit@intel.com> <20220830193537.52201-1-rodrigo.vivi@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Subject: Re: [Intel-gfx] [PATCH] drm/i915/slpc: Fix inconsistent locked return X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, Dan Carpenter Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Tue, 30 Aug 2022 12:35:37 -0700, Rodrigo Vivi wrote: > > Fix for intel_guc_slpc_set_min_freq() warn: > inconsistent returns '&slpc->lock'. > > v2: Avoid with_intel_runtime_pm with the > internal goto/return. (Ashutosh) > Also standardize the 'ret' if this came from > the efficient setup. And avoid the 'unlikely'. Reviewed-by: Ashutosh Dixit > Fixes: 95ccf312a1e4 ("drm/i915/guc/slpc: Allow SLPC to use efficient frequency") > Reported-by: kernel test robot > Reported-by: Dan Carpenter > Cc: Ashutosh Dixit > Signed-off-by: Rodrigo Vivi > --- > drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 40 ++++++++++----------- > 1 file changed, 20 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c > index 9d49ccef03bb..fdd895f73f9f 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c > +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c > @@ -467,33 +467,33 @@ int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val) > > /* Need a lock now since waitboost can be modifying min as well */ > mutex_lock(&slpc->lock); > - > - with_intel_runtime_pm(&i915->runtime_pm, wakeref) { > - > - /* Ignore efficient freq if lower min freq is requested */ > - ret = slpc_set_param(slpc, > - SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY, > - val < slpc->rp1_freq); > - if (unlikely(ret)) { > - i915_probe_error(i915, "Failed to toggle efficient freq (%pe)\n", > - ERR_PTR(ret)); > - return ret; > - } > - > - ret = slpc_set_param(slpc, > - SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ, > - val); > - > - /* Return standardized err code for sysfs calls */ > - if (ret) > - ret = -EIO; > + wakeref = intel_runtime_pm_get(&i915->runtime_pm); > + > + /* Ignore efficient freq if lower min freq is requested */ > + ret = slpc_set_param(slpc, > + SLPC_PARAM_IGNORE_EFFICIENT_FREQUENCY, > + val < slpc->rp1_freq); > + if (ret) { > + i915_probe_error(i915, "Failed to toggle efficient freq (%pe)\n", > + ERR_PTR(ret)); > + goto out; > } > > + ret = slpc_set_param(slpc, > + SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ, > + val); > + > if (!ret) > slpc->min_freq_softlimit = val; > > +out: > + intel_runtime_pm_put(&i915->runtime_pm, wakeref); > mutex_unlock(&slpc->lock); > > + /* Return standardized err code for sysfs calls */ > + if (ret) > + ret = -EIO; > + > return ret; > } > > -- > 2.37.2 >