[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231103114802.GQ17433@black.fi.intel.com>
Date: Fri, 3 Nov 2023 13:48:02 +0200
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: oe-kbuild@...ts.linux.dev, lkp@...el.com,
oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: drivers/thunderbolt/tmu.c:617 tb_switch_tmu_change_mode() warn:
missing unwind goto?
Hi Dan,
On Fri, Nov 03, 2023 at 09:01:34AM +0300, Dan Carpenter wrote:
> Hi Mika,
>
> FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 4652b8e4f3ffa48c706ec334f048c217a7d9750d
> commit: c437dcb18310f296eb9db58a361f309f7817014d thunderbolt: Fix a couple of style issues in TMU code
> config: i386-randconfig-141-20231102 (https://download.01.org/0day-ci/archive/20231103/202311030814.AXtCk7PO-lkp@intel.com/config)
> compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
> reproduce: (https://download.01.org/0day-ci/archive/20231103/202311030814.AXtCk7PO-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@...el.com>
> | Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> | Closes: https://lore.kernel.org/r/202311030814.AXtCk7PO-lkp@intel.com/
>
> smatch warnings:
> drivers/thunderbolt/tmu.c:617 tb_switch_tmu_change_mode() warn: missing unwind goto?
>
> vim +617 drivers/thunderbolt/tmu.c
>
> c437dcb18310f2 Mika Westerberg 2022-10-07 596 static int tb_switch_tmu_change_mode(struct tb_switch *sw)
> b017a46d486cd4 Gil Fine 2022-05-26 597 {
> b017a46d486cd4 Gil Fine 2022-05-26 598 struct tb_port *up, *down;
> b017a46d486cd4 Gil Fine 2022-05-26 599 int ret;
> b017a46d486cd4 Gil Fine 2022-05-26 600
> b017a46d486cd4 Gil Fine 2022-05-26 601 up = tb_upstream_port(sw);
> 7ce542219b6323 Gil Fine 2022-09-23 602 down = tb_switch_downstream_port(sw);
> b017a46d486cd4 Gil Fine 2022-05-26 603 ret = tb_port_tmu_set_unidirectional(down, sw->tmu.unidirectional_request);
> b017a46d486cd4 Gil Fine 2022-05-26 604 if (ret)
> b017a46d486cd4 Gil Fine 2022-05-26 605 goto out;
> b017a46d486cd4 Gil Fine 2022-05-26 606
> b017a46d486cd4 Gil Fine 2022-05-26 607 if (sw->tmu.unidirectional_request)
> 7ce542219b6323 Gil Fine 2022-09-23 608 ret = tb_switch_tmu_rate_write(tb_switch_parent(sw),
> 7ce542219b6323 Gil Fine 2022-09-23 609 sw->tmu.rate_request);
> b017a46d486cd4 Gil Fine 2022-05-26 610 else
> b017a46d486cd4 Gil Fine 2022-05-26 611 ret = tb_switch_tmu_rate_write(sw, sw->tmu.rate_request);
> b017a46d486cd4 Gil Fine 2022-05-26 612 if (ret)
> b017a46d486cd4 Gil Fine 2022-05-26 613 return ret;
>
> These error paths should be goto out;
>
> b017a46d486cd4 Gil Fine 2022-05-26 614
> b017a46d486cd4 Gil Fine 2022-05-26 615 ret = tb_switch_set_tmu_mode_params(sw, sw->tmu.rate_request);
> b017a46d486cd4 Gil Fine 2022-05-26 616 if (ret)
> b017a46d486cd4 Gil Fine 2022-05-26 @617 return ret;
>
> Same. (I guess before goto out was a do-nothing goto so it didn't
> matter).
Thanks for the report!
This code is different now in the mainline but this one is still there
and I agree it should goto out.
I will send a fix after -rc1 is released.
Powered by blists - more mailing lists