diff mbox

intel_telemetry_pltdrv: silence an unintialized variable warning

Message ID 20160415144558.GD8953@mwanda (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Dan Carpenter April 15, 2016, 2:45 p.m. UTC
Presumably "pss_period" and "ioss_period" can't both be zero, but this
function is never called so we can't infer that using static analysis
alone.

Let's silence the warning by setting "ret" to zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Chakravarty, Souvik K April 18, 2016, 4:28 a.m. UTC | #1
Looks good...thanks Dan.

> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Friday, April 15, 2016 8:16 PM
> To: Chakravarty, Souvik K <souvik.k.chakravarty@intel.com>
> Cc: Darren Hart <dvhart@infradead.org>; platform-driver-
> x86@vger.kernel.org; linux-kernel@vger.kernel.org; kernel-
> janitors@vger.kernel.org
> Subject: [patch] intel_telemetry_pltdrv: silence an unintialized variable
> warning
> 
> Presumably "pss_period" and "ioss_period" can't both be zero, but this
> function is never called so we can't infer that using static analysis alone.
> 
> Let's silence the warning by setting "ret" to zero.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/platform/x86/intel_telemetry_pltdrv.c
> b/drivers/platform/x86/intel_telemetry_pltdrv.c
> index 397119f..781bd10 100644
> --- a/drivers/platform/x86/intel_telemetry_pltdrv.c
> +++ b/drivers/platform/x86/intel_telemetry_pltdrv.c
> @@ -659,7 +659,7 @@ static int telemetry_plt_update_events(struct
> telemetry_evtconfig pss_evtconfig,  static int
> telemetry_plt_set_sampling_period(u8 pss_period, u8 ioss_period)  {
>  	u32 telem_ctrl = 0;
> -	int ret;
> +	int ret = 0;
> 
>  	mutex_lock(&(telm_conf->telem_lock));
>  	if (ioss_period) {
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/platform/x86/intel_telemetry_pltdrv.c b/drivers/platform/x86/intel_telemetry_pltdrv.c
index 397119f..781bd10 100644
--- a/drivers/platform/x86/intel_telemetry_pltdrv.c
+++ b/drivers/platform/x86/intel_telemetry_pltdrv.c
@@ -659,7 +659,7 @@  static int telemetry_plt_update_events(struct telemetry_evtconfig pss_evtconfig,
 static int telemetry_plt_set_sampling_period(u8 pss_period, u8 ioss_period)
 {
 	u32 telem_ctrl = 0;
-	int ret;
+	int ret = 0;
 
 	mutex_lock(&(telm_conf->telem_lock));
 	if (ioss_period) {