public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Eddie James <eajames@linux.ibm.com>,
	linux-fsi@lists.ozlabs.org
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	andi.shyti@kernel.org, eajames@linux.ibm.com,
	alistair@popple.id.au, joel@jms.id.au, jk@ozlabs.org,
	sboyd@kernel.org, mturquette@baylibre.com, robh@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org
Subject: Re: [PATCH 12/33] fsi: core: Allow cfam device type aliases
Date: Tue, 20 Feb 2024 11:31:03 +0300	[thread overview]
Message-ID: <13393c19-6de5-427d-8b4a-2e50cfe9459f@moroto.mountain> (raw)
In-Reply-To: <20240215220759.976998-13-eajames@linux.ibm.com>

Hi Eddie,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Eddie-James/dt-bindings-clock-ast2600-Add-FSI-clock/20240216-061934
base:   git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host
patch link:    https://lore.kernel.org/r/20240215220759.976998-13-eajames%40linux.ibm.com
patch subject: [PATCH 12/33] fsi: core: Allow cfam device type aliases
config: arm64-randconfig-r081-20240216 (https://download.01.org/0day-ci/archive/20240220/202402201532.dvENQrDs-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 36adfec155de366d722f2bac8ff9162289dcf06c)

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 <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202402201532.dvENQrDs-lkp@intel.com/

smatch warnings:
drivers/fsi/fsi-core.c:919 __fsi_get_new_minor() error: testing array offset 'type' after use.

vim +/type +919 drivers/fsi/fsi-core.c

3f4ac5b0b27f16 Eddie James            2024-02-15  894  static int __fsi_get_new_minor(struct fsi_slave *slave, struct device_node *np,
3f4ac5b0b27f16 Eddie James            2024-02-15  895  			       enum fsi_dev_type type, dev_t *out_dev, int *out_index)
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  896  {
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  897  	int cid = slave->chip_id;
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  898  	int id;
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  899  
3f4ac5b0b27f16 Eddie James            2024-02-15  900  	if (np) {
3f4ac5b0b27f16 Eddie James            2024-02-15  901  		int aid = of_alias_get_id(np, fsi_dev_type_names[type]);
                                                                                                                 ^^^^
if type >= 4 we are in trouble

3f4ac5b0b27f16 Eddie James            2024-02-15  902  
3f4ac5b0b27f16 Eddie James            2024-02-15  903  		if (aid >= 0) {
3f4ac5b0b27f16 Eddie James            2024-02-15  904  			/* Use the same scheme as the legacy numbers. */
3f4ac5b0b27f16 Eddie James            2024-02-15  905  			id = (aid << 2) | type;
3f4ac5b0b27f16 Eddie James            2024-02-15  906  			id = ida_alloc_range(&fsi_minor_ida, id, id, GFP_KERNEL);
3f4ac5b0b27f16 Eddie James            2024-02-15  907  			if (id >= 0) {
3f4ac5b0b27f16 Eddie James            2024-02-15  908  				*out_index = aid;
3f4ac5b0b27f16 Eddie James            2024-02-15  909  				*out_dev = fsi_base_dev + id;
3f4ac5b0b27f16 Eddie James            2024-02-15  910  				return 0;
3f4ac5b0b27f16 Eddie James            2024-02-15  911  			}
3f4ac5b0b27f16 Eddie James            2024-02-15  912  
3f4ac5b0b27f16 Eddie James            2024-02-15  913  			if (id != -ENOSPC)
3f4ac5b0b27f16 Eddie James            2024-02-15  914  				return id;
3f4ac5b0b27f16 Eddie James            2024-02-15  915  		}
3f4ac5b0b27f16 Eddie James            2024-02-15  916  	}
3f4ac5b0b27f16 Eddie James            2024-02-15  917  
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  918  	/* Check if we qualify for legacy numbering */
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20 @919  	if (cid >= 0 && cid < 16 && type < 4) {
                                                                                    ^^^^^^^^
checked too late

641511bfcc5e01 Eddie James            2023-06-12  920  		/*
641511bfcc5e01 Eddie James            2023-06-12  921  		 * Try reserving the legacy number, which has 0 - 0x3f reserved
641511bfcc5e01 Eddie James            2023-06-12  922  		 * in the ida range. cid goes up to 0xf and type contains two
641511bfcc5e01 Eddie James            2023-06-12  923  		 * bits, so construct the id with the below two bit shift.
641511bfcc5e01 Eddie James            2023-06-12  924  		 */
641511bfcc5e01 Eddie James            2023-06-12  925  		id = (cid << 2) | type;
85f4e899de32ba Eddie James            2023-06-12  926  		id = ida_alloc_range(&fsi_minor_ida, id, id, GFP_KERNEL);
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  927  		if (id >= 0) {
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  928  			*out_index = fsi_adjust_index(cid);
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  929  			*out_dev = fsi_base_dev + id;
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  930  			return 0;
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  931  		}
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  932  		/* Other failure */
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  933  		if (id != -ENOSPC)
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  934  			return id;
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  935  		/* Fallback to non-legacy allocation */
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  936  	}
85f4e899de32ba Eddie James            2023-06-12  937  	id = ida_alloc_range(&fsi_minor_ida, FSI_CHAR_LEGACY_TOP,
85f4e899de32ba Eddie James            2023-06-12  938  			     FSI_CHAR_MAX_DEVICES - 1, GFP_KERNEL);
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  939  	if (id < 0)
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  940  		return id;
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  941  	*out_index = fsi_adjust_index(id);
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  942  	*out_dev = fsi_base_dev + id;
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  943  	return 0;
0ab5fe5374743d Benjamin Herrenschmidt 2018-06-20  944  }

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


  reply	other threads:[~2024-02-20  8:31 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 22:07 [PATCH 00/33] fsi: Interrupt support Eddie James
2024-02-15 22:07 ` [PATCH 01/33] dt-bindings: clock: ast2600: Add FSI clock Eddie James
2024-02-16  8:07   ` Krzysztof Kozlowski
2024-02-22  5:45   ` Stephen Boyd
2024-02-15 22:07 ` [PATCH 02/33] clk: ast2600: Add FSI parent clock with correct rate Eddie James
2024-02-22  5:46   ` Stephen Boyd
2024-02-15 22:07 ` [PATCH 03/33] fsi: Move slave definitions to fsi-slave.h Eddie James
2024-02-15 22:07 ` [PATCH 04/33] fsi: Improve master indexing Eddie James
2024-02-15 22:07 ` [PATCH 05/33] fsi: Use a defined value for default echo delay Eddie James
2024-02-15 22:07 ` [PATCH 06/33] fsi: Expose master-specific local bus clock divider Eddie James
2024-02-15 22:07 ` [PATCH 07/33] ARM: dts: aspeed: p10 and tacoma: Set FSI clock frequency Eddie James
2024-02-16  8:08   ` Krzysztof Kozlowski
2024-02-16 19:14     ` Eddie James
2024-02-22 12:33       ` Joel Stanley
2024-02-15 22:07 ` [PATCH 08/33] fsi: core: Improve master read/write/error traces Eddie James
2024-02-15 22:07 ` [PATCH 09/33] fsi: core: Add slave error trace Eddie James
2024-02-15 22:07 ` [PATCH 10/33] fsi: aspeed: Add AST2700 support Eddie James
2024-02-16  8:09   ` Krzysztof Kozlowski
2024-02-16 19:18     ` Eddie James
2024-02-15 22:07 ` [PATCH 11/33] fsi: core: Add slave spinlock Eddie James
2024-02-15 22:07 ` [PATCH 12/33] fsi: core: Allow cfam device type aliases Eddie James
2024-02-20  8:31   ` Dan Carpenter [this message]
2024-02-15 22:07 ` [PATCH 13/33] fsi: core: Add common regmap master functions Eddie James
2024-02-15 22:07 ` [PATCH 14/33] fsi: hub: Use common initialization and link enable Eddie James
2024-02-15 22:07 ` [PATCH 15/33] fsi: aspeed: " Eddie James
2024-02-15 22:07 ` [PATCH 16/33] fsi: aspeed: Remove cfam reset sysfs file in error path and remove Eddie James
2024-02-15 22:07 ` [PATCH 17/33] fsi: aspeed: Refactor trace functions Eddie James
2024-02-15 22:07 ` [PATCH 18/33] fsi: aspeed: Don't clear all IRQs during OPB transfers Eddie James
2024-02-15 22:07 ` [PATCH 19/33] fsi: aspeed: Only read result register for successful read Eddie James
2024-02-15 22:07 ` [PATCH 20/33] fsi: aspeed: Switch to spinlock Eddie James
2024-02-15 22:07 ` [PATCH 21/33] fsi: aspeed: Disable relative addressing and IPOLL for cfam reset Eddie James
2024-02-15 22:07 ` [PATCH 22/33] fsi: aspeed: Use common master error handler Eddie James
2024-02-15 22:07 ` [PATCH 23/33] fsi: core: Add interrupt support Eddie James
2024-02-15 22:07 ` [PATCH 24/33] fsi: aspeed: " Eddie James
2024-02-15 22:07 ` [PATCH 25/33] fsi: hub: " Eddie James
2024-02-15 22:07 ` [PATCH 26/33] ARM: dts: aspeed: FSI " Eddie James
2024-02-16  8:11   ` Krzysztof Kozlowski
2024-02-15 22:07 ` [PATCH 27/33] i2c: fsi: Calculate clock divider from local bus frequency Eddie James
2024-02-15 22:07 ` [PATCH 28/33] i2c: fsi: Improve formatting Eddie James
2024-02-15 22:07 ` [PATCH 29/33] i2c: fsi: Change fsi_i2c_write_reg to accept data instead of a pointer Eddie James
2024-02-15 22:07 ` [PATCH 30/33] i2c: fsi: Remove list structure of ports Eddie James
2024-02-15 22:07 ` [PATCH 31/33] i2c: fsi: Define a function to check status error bits Eddie James
2024-02-15 22:07 ` [PATCH 32/33] i2c: fsi: Add boolean for skip stop command on abort Eddie James
2024-02-15 22:07 ` [PATCH 33/33] i2c: fsi: Add interrupt support Eddie James

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=13393c19-6de5-427d-8b4a-2e50cfe9459f@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=alistair@popple.id.au \
    --cc=andi.shyti@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eajames@linux.ibm.com \
    --cc=jk@ozlabs.org \
    --cc=joel@jms.id.au \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-fsi@lists.ozlabs.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mturquette@baylibre.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    /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