From: Dan Williams <dan.j.williams@intel.com>
To: Ira Weiny <ira.weiny@intel.com>, Dan Williams <dan.j.williams@intel.com>
Cc: <linux-cxl@vger.kernel.org>, kernel test robot <lkp@intel.com>,
<vishal.l.verma@intel.com>, <alison.schofield@intel.com>,
<dave.jiang@intel.com>
Subject: Re: [PATCH 4/4] cxl/region: Fix region commit uninitialized variable warning
Date: Thu, 4 Aug 2022 13:33:57 -0700 [thread overview]
Message-ID: <62ec2d353338c_8814829453@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <Yurxs8Fy0UXgspPo@iweiny-desk3>
Ira Weiny wrote:
> On Wed, Aug 03, 2022 at 02:49:37PM -0700, Ira wrote:
> > On Wed, Aug 03, 2022 at 12:24:41AM -0700, Dan Williams wrote:
> > > 0day robot reports:
> > >
> > > drivers/cxl/core/region.c:196 cxl_region_decode_commit() error: uninitialized symbol 'rc'.
> > >
> > > The re-checking of loop termination conditions to determine "success"
> > > makes it hard to see that @rc is initialized in all cases. Remove those
> > > to make it explicit that @rc reflects a commit error and that the rest
> > > of logic is concerned with unwinding committed decoders.
> > >
> > > Fixes: 176baefb2eb5 ("cxl/hdm: Commit decoder state to hardware")
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> > > ---
> > > drivers/cxl/core/region.c | 12 +++++-------
> > > 1 file changed, 5 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> > > index 5c931b6eb4e7..a68e4e0cf169 100644
> > > --- a/drivers/cxl/core/region.c
> > > +++ b/drivers/cxl/core/region.c
> > > @@ -159,7 +159,7 @@ static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)
> > > static int cxl_region_decode_commit(struct cxl_region *cxlr)
> > > {
> > > struct cxl_region_params *p = &cxlr->params;
> > > - int i, rc;
> > > + int i, rc = 0;
> > >
> > > for (i = 0; i < p->nr_targets; i++) {
> > > struct cxl_endpoint_decoder *cxled = p->targets[i];
> > > @@ -180,7 +180,7 @@ static int cxl_region_decode_commit(struct cxl_region *cxlr)
> > > }
> > >
> > > /* success, all decoders up to the root are programmed */
> > > - if (is_cxl_root(iter))
> > > + if (rc == 0)
> > > continue;
> > >
> > > /* programming @iter failed, teardown */
> > > @@ -192,14 +192,12 @@ static int cxl_region_decode_commit(struct cxl_region *cxlr)
> > > }
> > >
> > > cxled->cxld.reset(&cxled->cxld);
> > > - if (i == 0)
> > > - return rc;
> > > - break;
> > > + goto err;
> > > }
> > >
> > > - if (i >= p->nr_targets)
> > > - return 0;
> > > + return 0;
> > >
> > > +err:
> > > /* undo the targets that were successfully committed */
> > > cxl_region_decode_reset(cxlr, i);
> >
> > Doesn't this take care of teardown now? Does the for loop even need to do
> > teardown now?
>
> Never mind I think I see how this logic is the same.
Ah cool, disregard my last reply.
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Thanks!
next prev parent reply other threads:[~2022-08-04 20:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-03 7:24 [PATCH 0/4] cxl/region: Endpoint decoder fixes Dan Williams
2022-08-03 7:24 ` [PATCH 1/4] cxl/region: Fix decoder interleave programming Dan Williams
2022-08-03 15:24 ` Jonathan Cameron
2022-08-03 7:24 ` [PATCH 2/4] cxl/region: Move HPA setup to cxl_region_attach() Dan Williams
2022-08-03 15:25 ` Jonathan Cameron
2022-08-03 7:24 ` [PATCH 3/4] cxl/region: Fix port setup uninitialized variable warnings Dan Williams
2022-08-03 15:28 ` Jonathan Cameron
2022-08-03 21:22 ` Ira Weiny
2022-08-04 20:26 ` Dan Williams
2022-08-03 7:24 ` [PATCH 4/4] cxl/region: Fix region commit uninitialized variable warning Dan Williams
2022-08-03 15:41 ` Jonathan Cameron
2022-08-03 21:49 ` Ira Weiny
2022-08-03 22:07 ` Ira Weiny
2022-08-04 20:33 ` Dan Williams [this message]
2022-08-04 20:30 ` Dan Williams
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=62ec2d353338c_8814829453@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=lkp@intel.com \
--cc=vishal.l.verma@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox