From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Wang Yufen <wangyufen@huawei.com>
Cc: bvanassche@acm.org, jgg@ziepe.ca, leon@kernel.org,
dennis.dalessandro@cornelisnetworks.com,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
bart.vanassche@wdc.com, easwar.hariharan@intel.com
Subject: Re: [PATCH 1/2] RDMA/hfi1: Fix error return code in parse_platform_config()
Date: Fri, 25 Nov 2022 16:31:07 +0200 [thread overview]
Message-ID: <Y4DRqzSGtsqTpAhU@smile.fi.intel.com> (raw)
In-Reply-To: <1669377831-41386-1-git-send-email-wangyufen@huawei.com>
On Fri, Nov 25, 2022 at 08:03:50PM +0800, Wang Yufen wrote:
> In the previous while loop, "ret" may be assigned zero. Therefore,
> "ret" needs to be assigned -EINVAL at the beginning of each loop.
...
> while (ptr < (u32 *)(dd->platform_config.data + file_length)) {
> + ret = -EINVAL;
> header1 = *ptr;
> header2 = *(ptr + 1);
> if (header1 != ~header2) {
You may do it differently and simplify even existing code, i.e.
// The following two lines to add
bali_with_einval:
ret = -EINVAL;
bail:
memset(pcfgcache, 0, sizeof(struct platform_config_cache));
return ret;
Then you convert all goto bail; to goto bail_with_einval; where it's
appropriate. And dropping some duplicative ret = -EINVAL; lines above.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2022-11-25 14:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 12:03 [PATCH 1/2] RDMA/hfi1: Fix error return code in parse_platform_config() Wang Yufen
2022-11-25 12:03 ` [PATCH 2/2] RDMA/srp: Fix error return code in srp_parse_options() Wang Yufen
2022-11-25 14:37 ` Andy Shevchenko
2022-11-26 1:23 ` wangyufen
2022-11-25 14:31 ` Andy Shevchenko [this message]
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=Y4DRqzSGtsqTpAhU@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bart.vanassche@wdc.com \
--cc=bvanassche@acm.org \
--cc=dennis.dalessandro@cornelisnetworks.com \
--cc=easwar.hariharan@intel.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=wangyufen@huawei.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