All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [cip:linux-4.19.y-cip-rebase 576/965] drivers/usb/typec/mux.c:169 typec_mux_match() warn: missing unwind goto?
Date: Fri, 27 Sep 2024 20:59:51 +0800	[thread overview]
Message-ID: <202409272010.RJVqF8In-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/cip/linux-cip.git linux-4.19.y-cip-rebase
head:   43848671a69f7ed12a877f0249e0e1b1a1628066
commit: 61703341348288c799c78660d36d1ddabad29ccc [576/965] usb: typec: mux: Fix unsigned comparison with less than zero
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-141-20240927 (https://download.01.org/0day-ci/archive/20240927/202409272010.RJVqF8In-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202409272010.RJVqF8In-lkp@intel.com/

smatch warnings:
drivers/usb/typec/mux.c:169 typec_mux_match() warn: missing unwind goto?

vim +169 drivers/usb/typec/mux.c

bdecb33af34f79 Heikki Krogerus 2018-03-20  124  
bdecb33af34f79 Heikki Krogerus 2018-03-20  125  static void *typec_mux_match(struct device_connection *con, int ep, void *data)
bdecb33af34f79 Heikki Krogerus 2018-03-20  126  {
4c4129e8af94c1 Heikki Krogerus 2020-02-21  127  	const struct typec_altmode_desc *desc = data;
bdecb33af34f79 Heikki Krogerus 2018-03-20  128  	struct typec_mux *mux;
61703341348288 YueHaibing      2020-02-21  129  	int nval;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  130  	bool match;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  131  	u16 *val;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  132  	int i;
bdecb33af34f79 Heikki Krogerus 2018-03-20  133  
4c4129e8af94c1 Heikki Krogerus 2020-02-21  134  	if (!con->fwnode) {
bdecb33af34f79 Heikki Krogerus 2018-03-20  135  		list_for_each_entry(mux, &mux_list, entry)
bdecb33af34f79 Heikki Krogerus 2018-03-20  136  			if (!strcmp(con->endpoint[ep], dev_name(mux->dev)))
bdecb33af34f79 Heikki Krogerus 2018-03-20  137  				return mux;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  138  		return ERR_PTR(-EPROBE_DEFER);
4c4129e8af94c1 Heikki Krogerus 2020-02-21  139  	}
bdecb33af34f79 Heikki Krogerus 2018-03-20  140  
bdecb33af34f79 Heikki Krogerus 2018-03-20  141  	/*
4c4129e8af94c1 Heikki Krogerus 2020-02-21  142  	 * Check has the identifier already been "consumed". If it
4c4129e8af94c1 Heikki Krogerus 2020-02-21  143  	 * has, no need to do any extra connection identification.
bdecb33af34f79 Heikki Krogerus 2018-03-20  144  	 */
4c4129e8af94c1 Heikki Krogerus 2020-02-21  145  	match = !con->id;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  146  	if (match)
4c4129e8af94c1 Heikki Krogerus 2020-02-21  147  		goto find_mux;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  148  
4c4129e8af94c1 Heikki Krogerus 2020-02-21  149  	/* Accessory Mode muxes */
4c4129e8af94c1 Heikki Krogerus 2020-02-21  150  	if (!desc) {
4c4129e8af94c1 Heikki Krogerus 2020-02-21  151  		match = fwnode_property_present(con->fwnode, "accessory");
4c4129e8af94c1 Heikki Krogerus 2020-02-21  152  		if (match)
4c4129e8af94c1 Heikki Krogerus 2020-02-21  153  			goto find_mux;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  154  		return NULL;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  155  	}
4c4129e8af94c1 Heikki Krogerus 2020-02-21  156  
4c4129e8af94c1 Heikki Krogerus 2020-02-21  157  	/* Alternate Mode muxes */
4c4129e8af94c1 Heikki Krogerus 2020-02-21  158  	nval = fwnode_property_read_u16_array(con->fwnode, "svid", NULL, 0);
4c4129e8af94c1 Heikki Krogerus 2020-02-21  159  	if (nval <= 0)
4c4129e8af94c1 Heikki Krogerus 2020-02-21  160  		return NULL;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  161  
4c4129e8af94c1 Heikki Krogerus 2020-02-21  162  	val = kcalloc(nval, sizeof(*val), GFP_KERNEL);
4c4129e8af94c1 Heikki Krogerus 2020-02-21  163  	if (!val)
4c4129e8af94c1 Heikki Krogerus 2020-02-21  164  		return ERR_PTR(-ENOMEM);
4c4129e8af94c1 Heikki Krogerus 2020-02-21  165  
4c4129e8af94c1 Heikki Krogerus 2020-02-21  166  	nval = fwnode_property_read_u16_array(con->fwnode, "svid", val, nval);
4c4129e8af94c1 Heikki Krogerus 2020-02-21  167  	if (nval < 0) {
4c4129e8af94c1 Heikki Krogerus 2020-02-21  168  		kfree(val);
4c4129e8af94c1 Heikki Krogerus 2020-02-21 @169  		return ERR_PTR(nval);
4c4129e8af94c1 Heikki Krogerus 2020-02-21  170  	}
4c4129e8af94c1 Heikki Krogerus 2020-02-21  171  
4c4129e8af94c1 Heikki Krogerus 2020-02-21  172  	for (i = 0; i < nval; i++) {
4c4129e8af94c1 Heikki Krogerus 2020-02-21  173  		match = val[i] == desc->svid;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  174  		if (match) {
4c4129e8af94c1 Heikki Krogerus 2020-02-21  175  			kfree(val);
4c4129e8af94c1 Heikki Krogerus 2020-02-21  176  			goto find_mux;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  177  		}
4c4129e8af94c1 Heikki Krogerus 2020-02-21  178  	}
4c4129e8af94c1 Heikki Krogerus 2020-02-21  179  	kfree(val);
4c4129e8af94c1 Heikki Krogerus 2020-02-21  180  	return NULL;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  181  
4c4129e8af94c1 Heikki Krogerus 2020-02-21  182  find_mux:
4c4129e8af94c1 Heikki Krogerus 2020-02-21  183  	list_for_each_entry(mux, &mux_list, entry)
4c4129e8af94c1 Heikki Krogerus 2020-02-21  184  		if (dev_fwnode(mux->dev) == con->fwnode)
4c4129e8af94c1 Heikki Krogerus 2020-02-21  185  			return mux;
4c4129e8af94c1 Heikki Krogerus 2020-02-21  186  
4c4129e8af94c1 Heikki Krogerus 2020-02-21  187  	return match ? ERR_PTR(-EPROBE_DEFER) : NULL;
bdecb33af34f79 Heikki Krogerus 2018-03-20  188  }
bdecb33af34f79 Heikki Krogerus 2018-03-20  189  

:::::: The code at line 169 was first introduced by commit
:::::: 4c4129e8af94c11836bd48f475df6fa319c9fada usb: typec: mux: Find the muxes by also matching against the device node

:::::: TO: Heikki Krogerus <heikki.krogerus@linux.intel.com>
:::::: CC: Pavel Machek <pavel@ucw.cz>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-09-27 13:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202409272010.RJVqF8In-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.