[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190613074922.GB21113@leoy-ThinkPad-X240s>
Date: Thu, 13 Jun 2019 15:49:22 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] coresight: potential uninitialized variable in probe()
Hi Dan,
On Wed, Jun 12, 2019 at 11:58:15PM -0700, Dan Carpenter wrote:
> The "drvdata->atclk" clock is optional, but if it gets set to an error
> pointer then we're accidentally return an uninitialized variable instead
> of success.
You are right, thanks a lot for pointing out.
I'd like to initialize 'ret = 0' at the head of function, so we can
has the same fashion with other CoreSight drivers (e.g. replicator).
static int funnel_probe(struct device *dev, struct resource *res)
{
- int ret;
+ int ret = 0;
If you agree, could you send a new patch for this?
Thanks,
Leo Yan
> Fixes: 78e6427b4e7b ("coresight: funnel: Support static funnel")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
> ---
> drivers/hwtracing/coresight/coresight-funnel.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
> index 5867fcb4503b..fa97cb9ab4f9 100644
> --- a/drivers/hwtracing/coresight/coresight-funnel.c
> +++ b/drivers/hwtracing/coresight/coresight-funnel.c
> @@ -244,6 +244,7 @@ static int funnel_probe(struct device *dev, struct resource *res)
> }
>
> pm_runtime_put(dev);
> + ret = 0;
>
> out_disable_clk:
> if (ret && !IS_ERR_OR_NULL(drvdata->atclk))
> --
> 2.20.1
>
Powered by blists - more mailing lists