* [PATCH] usb: core: remove unnecessary goto in usb_create_newid_files()
@ 2026-03-04 3:34 Mark Adamenko
2026-03-04 8:01 ` kernel test robot
2026-03-04 8:52 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Mark Adamenko @ 2026-03-04 3:34 UTC (permalink / raw)
To: linux-usb; +Cc: gregkh, linux-kernel, Mark Adamenko
The goto to 'exit' only returns the already initialized variable
'error', which would be 0. At that point it could not yet be anything
else. Replacing with an early return 0 removes the
need for the label entirely.
Signed-off-by: Mark Adamenko <marusik.adamenko@gmail.com>
---
drivers/usb/core/driver.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 2574e65bc640..571b7d78e814 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -186,7 +186,7 @@ static int usb_create_newid_files(struct usb_driver *usb_drv)
int error = 0;
if (usb_drv->no_dynamic_id)
- goto exit;
+ return error;
if (usb_drv->probe != NULL) {
error = driver_create_file(&usb_drv->driver,
@@ -199,8 +199,6 @@ static int usb_create_newid_files(struct usb_driver *usb_drv)
&driver_attr_new_id);
}
}
-exit:
- return error;
}
static void usb_remove_newid_files(struct usb_driver *usb_drv)
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: core: remove unnecessary goto in usb_create_newid_files()
2026-03-04 3:34 [PATCH] usb: core: remove unnecessary goto in usb_create_newid_files() Mark Adamenko
@ 2026-03-04 8:01 ` kernel test robot
2026-03-04 8:52 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-03-04 8:01 UTC (permalink / raw)
To: Mark Adamenko, linux-usb
Cc: llvm, oe-kbuild-all, gregkh, linux-kernel, Mark Adamenko
Hi Mark,
kernel test robot noticed the following build warnings:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus westeri-thunderbolt/next linus/master v7.0-rc2 next-20260303]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mark-Adamenko/usb-core-remove-unnecessary-goto-in-usb_create_newid_files/20260304-113844
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20260304033418.49357-1-marusik.adamenko%40gmail.com
patch subject: [PATCH] usb: core: remove unnecessary goto in usb_create_newid_files()
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260304/202603040835.L3sNN4Lh-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260304/202603040835.L3sNN4Lh-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603040835.L3sNN4Lh-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/usb/core/driver.c:202:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
202 | }
| ^
1 warning generated.
vim +202 drivers/usb/core/driver.c
0c7a2b72746a96 CHENG Renquan 2009-11-22 183
ed283e9f0a2cc0 Alan Stern 2012-01-24 184 static int usb_create_newid_files(struct usb_driver *usb_drv)
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 185 {
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 186 int error = 0;
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 187
ba9dc657af86d0 Greg Kroah-Hartman 2005-11-16 188 if (usb_drv->no_dynamic_id)
5523ca85805b3e Mark Adamenko 2026-03-03 189 return error;
ba9dc657af86d0 Greg Kroah-Hartman 2005-11-16 190
ed283e9f0a2cc0 Alan Stern 2012-01-24 191 if (usb_drv->probe != NULL) {
49a78b05d5ca1e Yajun Deng 2024-01-04 192 error = driver_create_file(&usb_drv->driver,
15147ffd57576f Greg Kroah-Hartman 2007-11-28 193 &driver_attr_new_id);
ed283e9f0a2cc0 Alan Stern 2012-01-24 194 if (error == 0) {
49a78b05d5ca1e Yajun Deng 2024-01-04 195 error = driver_create_file(&usb_drv->driver,
ed283e9f0a2cc0 Alan Stern 2012-01-24 196 &driver_attr_remove_id);
ed283e9f0a2cc0 Alan Stern 2012-01-24 197 if (error)
49a78b05d5ca1e Yajun Deng 2024-01-04 198 driver_remove_file(&usb_drv->driver,
ed283e9f0a2cc0 Alan Stern 2012-01-24 199 &driver_attr_new_id);
ed283e9f0a2cc0 Alan Stern 2012-01-24 200 }
ed283e9f0a2cc0 Alan Stern 2012-01-24 201 }
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 @202 }
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 203
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: core: remove unnecessary goto in usb_create_newid_files()
2026-03-04 3:34 [PATCH] usb: core: remove unnecessary goto in usb_create_newid_files() Mark Adamenko
2026-03-04 8:01 ` kernel test robot
@ 2026-03-04 8:52 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-03-04 8:52 UTC (permalink / raw)
To: Mark Adamenko, linux-usb
Cc: oe-kbuild-all, gregkh, linux-kernel, Mark Adamenko
Hi Mark,
kernel test robot noticed the following build warnings:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus westeri-thunderbolt/next linus/master v6.16-rc1 next-20260303]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mark-Adamenko/usb-core-remove-unnecessary-goto-in-usb_create_newid_files/20260304-113844
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20260304033418.49357-1-marusik.adamenko%40gmail.com
patch subject: [PATCH] usb: core: remove unnecessary goto in usb_create_newid_files()
config: riscv-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260304/202603040948.m6LKXcFm-lkp@intel.com/config)
compiler: riscv64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260304/202603040948.m6LKXcFm-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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603040948.m6LKXcFm-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/usb/core/driver.c: In function 'usb_create_newid_files':
>> drivers/usb/core/driver.c:202:1: warning: control reaches end of non-void function [-Wreturn-type]
202 | }
| ^
vim +202 drivers/usb/core/driver.c
0c7a2b72746a96 CHENG Renquan 2009-11-22 183
ed283e9f0a2cc0 Alan Stern 2012-01-24 184 static int usb_create_newid_files(struct usb_driver *usb_drv)
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 185 {
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 186 int error = 0;
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 187
ba9dc657af86d0 Greg Kroah-Hartman 2005-11-16 188 if (usb_drv->no_dynamic_id)
5523ca85805b3e Mark Adamenko 2026-03-03 189 return error;
ba9dc657af86d0 Greg Kroah-Hartman 2005-11-16 190
ed283e9f0a2cc0 Alan Stern 2012-01-24 191 if (usb_drv->probe != NULL) {
49a78b05d5ca1e Yajun Deng 2024-01-04 192 error = driver_create_file(&usb_drv->driver,
15147ffd57576f Greg Kroah-Hartman 2007-11-28 193 &driver_attr_new_id);
ed283e9f0a2cc0 Alan Stern 2012-01-24 194 if (error == 0) {
49a78b05d5ca1e Yajun Deng 2024-01-04 195 error = driver_create_file(&usb_drv->driver,
ed283e9f0a2cc0 Alan Stern 2012-01-24 196 &driver_attr_remove_id);
ed283e9f0a2cc0 Alan Stern 2012-01-24 197 if (error)
49a78b05d5ca1e Yajun Deng 2024-01-04 198 driver_remove_file(&usb_drv->driver,
ed283e9f0a2cc0 Alan Stern 2012-01-24 199 &driver_attr_new_id);
ed283e9f0a2cc0 Alan Stern 2012-01-24 200 }
ed283e9f0a2cc0 Alan Stern 2012-01-24 201 }
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 @202 }
733260ff9c45bd Greg Kroah-Hartman 2005-11-16 203
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-04 8:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 3:34 [PATCH] usb: core: remove unnecessary goto in usb_create_newid_files() Mark Adamenko
2026-03-04 8:01 ` kernel test robot
2026-03-04 8:52 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox