All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/media/i2c/ccs/ccs-core.c:2040:3: warning: Division by zero [clang-analyzer-core.DivideZero]
Date: Mon, 13 Sep 2021 15:53:05 +0800	[thread overview]
Message-ID: <202109131557.7TdynkZN-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 30838 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Sakari Ailus <sakari.ailus@linux.intel.com>
CC: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f
commit: b24cc2a18c50e4e315abc76a86b26b4c49652f79 media: smiapp: Rename as "ccs"
date:   10 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 10 months ago
config: riscv-randconfig-c006-20210908 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 9c476172b93367d2cb88d7d3f4b1b5b456fa6020)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b24cc2a18c50e4e315abc76a86b26b4c49652f79
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout b24cc2a18c50e4e315abc76a86b26b4c49652f79
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
                   if (crops)
                       ^~~~~
   drivers/media/i2c/ccs/ccs-core.c:1749:3: note: Taking true branch
                   if (crops)
                   ^
   drivers/media/i2c/ccs/ccs-core.c:1750:16: note: Assuming 'i' is >= field 'num_pads'
                           for (i = 0; i < subdev->entity.num_pads; i++)
                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/ccs/ccs-core.c:1750:4: note: Loop condition is false. Execution continues on line 1752
                           for (i = 0; i < subdev->entity.num_pads; i++)
                           ^
   drivers/media/i2c/ccs/ccs-core.c:1752:7: note: 'comps' is non-null
                   if (comps)
                       ^~~~~
   drivers/media/i2c/ccs/ccs-core.c:1752:3: note: Taking true branch
                   if (comps)
                   ^
   drivers/media/i2c/ccs/ccs-core.c:1767:1: note: Returning without writing to '*crops'
   }
   ^
   drivers/media/i2c/ccs/ccs-core.c:2136:2: note: Returning from 'ccs_get_crop_compose'
           ccs_get_crop_compose(subdev, cfg, crops, &comp, sel->which);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/ccs/ccs-core.c:2141:6: note: Assuming 'ssd' is not equal to field 'binner'
           if (ssd == sensor->binner)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/ccs/ccs-core.c:2141:2: note: Taking false branch
           if (ssd == sensor->binner)
           ^
   drivers/media/i2c/ccs/ccs-core.c:2144:3: note: Calling 'ccs_set_compose_scaler'
                   ccs_set_compose_scaler(subdev, cfg, sel, crops, comp);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/ccs/ccs-core.c:2020:30: note: Left side of '&&' is false
           struct ccs_sensor *sensor = to_ccs_sensor(subdev);
                                       ^
   drivers/media/i2c/ccs/ccs.h:276:3: note: expanded from macro 'to_ccs_sensor'
           (to_ccs_subdev(_sd)->sensor)
            ^
   drivers/media/i2c/ccs/ccs.h:273:2: note: expanded from macro 'to_ccs_subdev'
           container_of(_sd, struct ccs_subdev, sd)
           ^
   include/linux/kernel.h:853:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/media/i2c/ccs/ccs-core.c:2020:30: note: Taking false branch
           struct ccs_sensor *sensor = to_ccs_sensor(subdev);
                                       ^
   drivers/media/i2c/ccs/ccs.h:276:3: note: expanded from macro 'to_ccs_sensor'
           (to_ccs_subdev(_sd)->sensor)
            ^
   drivers/media/i2c/ccs/ccs.h:273:2: note: expanded from macro 'to_ccs_subdev'
           container_of(_sd, struct ccs_subdev, sd)
           ^
   include/linux/kernel.h:853:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:295:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/media/i2c/ccs/ccs-core.c:2020:30: note: Loop condition is false.  Exiting loop
           struct ccs_sensor *sensor = to_ccs_sensor(subdev);
                                       ^
   drivers/media/i2c/ccs/ccs.h:276:3: note: expanded from macro 'to_ccs_sensor'
           (to_ccs_subdev(_sd)->sensor)
            ^
   drivers/media/i2c/ccs/ccs.h:273:2: note: expanded from macro 'to_ccs_subdev'
           container_of(_sd, struct ccs_subdev, sd)
           ^
   include/linux/kernel.h:853:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:293:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/media/i2c/ccs/ccs-core.c:2029:17: note: Access to field 'width' results in a dereference of an undefined pointer value
           sel->r.width = min_t(unsigned int, sel->r.width,
                          ^
   include/linux/minmax.h:110:58: note: expanded from macro 'min_t'
   #define min_t(type, x, y)       __careful_cmp((type)(x), (type)(y), <)
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
   include/linux/minmax.h:44:17: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:38:25: note: expanded from macro '__cmp_once'
                   typeof(y) unique_y = (y);               \
                                         ^
>> drivers/media/i2c/ccs/ccs-core.c:2040:3: warning: Division by zero [clang-analyzer-core.DivideZero]
                   / CCS_LIM(sensor, MIN_X_OUTPUT_SIZE);
                   ^
   drivers/media/i2c/ccs/ccs-core.c:2319:30: note: Left side of '&&' is false
           struct ccs_sensor *sensor = to_ccs_sensor(subdev);
                                       ^
   drivers/media/i2c/ccs/ccs.h:276:3: note: expanded from macro 'to_ccs_sensor'
           (to_ccs_subdev(_sd)->sensor)
            ^
   drivers/media/i2c/ccs/ccs.h:273:2: note: expanded from macro 'to_ccs_subdev'
           container_of(_sd, struct ccs_subdev, sd)
           ^
   include/linux/kernel.h:853:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/media/i2c/ccs/ccs-core.c:2319:30: note: Taking false branch
           struct ccs_sensor *sensor = to_ccs_sensor(subdev);
                                       ^
   drivers/media/i2c/ccs/ccs.h:276:3: note: expanded from macro 'to_ccs_sensor'
           (to_ccs_subdev(_sd)->sensor)
            ^
   drivers/media/i2c/ccs/ccs.h:273:2: note: expanded from macro 'to_ccs_subdev'
           container_of(_sd, struct ccs_subdev, sd)
           ^
   include/linux/kernel.h:853:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:295:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/media/i2c/ccs/ccs-core.c:2319:30: note: Loop condition is false.  Exiting loop
           struct ccs_sensor *sensor = to_ccs_sensor(subdev);
                                       ^
   drivers/media/i2c/ccs/ccs.h:276:3: note: expanded from macro 'to_ccs_sensor'
           (to_ccs_subdev(_sd)->sensor)
            ^
   drivers/media/i2c/ccs/ccs.h:273:2: note: expanded from macro 'to_ccs_subdev'
           container_of(_sd, struct ccs_subdev, sd)
           ^
   include/linux/kernel.h:853:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:315:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:303:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:293:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/media/i2c/ccs/ccs-core.c:2323:6: note: 'ret' is 0
           if (ret)
               ^~~
   drivers/media/i2c/ccs/ccs-core.c:2323:2: note: Taking false branch
           if (ret)
           ^
   drivers/media/i2c/ccs/ccs-core.c:2328:16: note: Assuming '__UNIQUE_ID___x417' is <= '__UNIQUE_ID___y418'
           sel->r.left = max(0, sel->r.left & ~1);
                         ^
   include/linux/minmax.h:58:19: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(x, y, >)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:44:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:39:3: note: expanded from macro '__cmp_once'
                   __cmp(unique_x, unique_y, op); })
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:34:26: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                            ^~~~~~~~~~
   drivers/media/i2c/ccs/ccs-core.c:2328:16: note: '?' condition is false
           sel->r.left = max(0, sel->r.left & ~1);
                         ^
   include/linux/minmax.h:58:19: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(x, y, >)
                           ^
   include/linux/minmax.h:44:3: note: expanded from macro '__careful_cmp'
                   __cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
                   ^
   include/linux/minmax.h:39:3: note: expanded from macro '__cmp_once'
                   __cmp(unique_x, unique_y, op); })
                   ^
   include/linux/minmax.h:34:26: note: expanded from macro '__cmp'
   #define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
                            ^
   drivers/media/i2c/ccs/ccs-core.c:2329:15: note: Assuming '__UNIQUE_ID___x419' is <= '__UNIQUE_ID___y420'
           sel->r.top = max(0, sel->r.top & ~1);
                        ^
   include/linux/minmax.h:58:19: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(x, y, >)
                           ^~~~~~~~~~~~~~~~~~~~~~

vim +2040 drivers/media/i2c/ccs/ccs-core.c

ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2003  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2004  /*
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2005   * Calculate best scaling ratio and mode for given output resolution.
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2006   *
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2007   * Try all of these: horizontal ratio, vertical ratio and smallest
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2008   * size possible (horizontally).
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2009   *
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2010   * Also try whether horizontal scaler or full scaler gives a better
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2011   * result.
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2012   */
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2013  static void ccs_set_compose_scaler(struct v4l2_subdev *subdev,
f7234138f14c22 drivers/media/i2c/smiapp/smiapp-core.c   Hans Verkuil 2015-03-04  2014  				   struct v4l2_subdev_pad_config *cfg,
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2015  				   struct v4l2_subdev_selection *sel,
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2016  				   struct v4l2_rect **crops,
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2017  				   struct v4l2_rect *comp)
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2018  {
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2019  	struct i2c_client *client = v4l2_get_subdevdata(subdev);
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2020  	struct ccs_sensor *sensor = to_ccs_sensor(subdev);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2021  	u32 min, max, a, b, max_m;
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2022  	u32 scale_m = CCS_LIM(sensor, SCALER_N_MIN);
42aab58f456a28 drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-11  2023  	int mode = CCS_SCALING_MODE_HORIZONTAL;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2024  	u32 try[4];
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2025  	u32 ntry = 0;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2026  	unsigned int i;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2027  	int best = INT_MIN;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2028  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2029  	sel->r.width = min_t(unsigned int, sel->r.width,
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2030  			     crops[CCS_PAD_SINK]->width);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2031  	sel->r.height = min_t(unsigned int, sel->r.height,
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2032  			      crops[CCS_PAD_SINK]->height);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2033  
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2034  	a = crops[CCS_PAD_SINK]->width
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2035  		* CCS_LIM(sensor, SCALER_N_MIN) / sel->r.width;
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2036  	b = crops[CCS_PAD_SINK]->height
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2037  		* CCS_LIM(sensor, SCALER_N_MIN) / sel->r.height;
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2038  	max_m = crops[CCS_PAD_SINK]->width
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2039  		* CCS_LIM(sensor, SCALER_N_MIN)
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10 @2040  		/ CCS_LIM(sensor, MIN_X_OUTPUT_SIZE);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2041  
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2042  	a = clamp(a, CCS_LIM(sensor, SCALER_M_MIN),
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2043  		  CCS_LIM(sensor, SCALER_M_MAX));
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2044  	b = clamp(b, CCS_LIM(sensor, SCALER_M_MIN),
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2045  		  CCS_LIM(sensor, SCALER_M_MAX));
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2046  	max_m = clamp(max_m, CCS_LIM(sensor, SCALER_M_MIN),
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2047  		      CCS_LIM(sensor, SCALER_M_MAX));
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2048  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2049  	dev_dbg(&client->dev, "scaling: a %d b %d max_m %d\n", a, b, max_m);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2050  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2051  	min = min(max_m, min(a, b));
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2052  	max = min(max_m, max(a, b));
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2053  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2054  	try[ntry] = min;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2055  	ntry++;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2056  	if (min != max) {
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2057  		try[ntry] = max;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2058  		ntry++;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2059  	}
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2060  	if (max != max_m) {
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2061  		try[ntry] = min + 1;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2062  		ntry++;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2063  		if (min != max) {
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2064  			try[ntry] = max + 1;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2065  			ntry++;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2066  		}
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2067  	}
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2068  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2069  	for (i = 0; i < ntry; i++) {
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2070  		int this = scaling_goodness(
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2071  			subdev,
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2072  			crops[CCS_PAD_SINK]->width
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2073  			/ try[i] * CCS_LIM(sensor, SCALER_N_MIN),
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2074  			sel->r.width,
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2075  			crops[CCS_PAD_SINK]->height,
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2076  			sel->r.height,
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2077  			sel->flags);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2078  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2079  		dev_dbg(&client->dev, "trying factor %d (%d)\n", try[i], i);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2080  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2081  		if (this > best) {
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2082  			scale_m = try[i];
42aab58f456a28 drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-11  2083  			mode = CCS_SCALING_MODE_HORIZONTAL;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2084  			best = this;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2085  		}
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2086  
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2087  		if (CCS_LIM(sensor, SCALING_CAPABILITY)
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2088  		    == CCS_SCALING_CAPABILITY_HORIZONTAL)
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2089  			continue;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2090  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2091  		this = scaling_goodness(
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2092  			subdev, crops[CCS_PAD_SINK]->width
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2093  			/ try[i]
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2094  			* CCS_LIM(sensor, SCALER_N_MIN),
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2095  			sel->r.width,
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2096  			crops[CCS_PAD_SINK]->height
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2097  			/ try[i]
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2098  			* CCS_LIM(sensor, SCALER_N_MIN),
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2099  			sel->r.height,
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2100  			sel->flags);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2101  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2102  		if (this > best) {
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2103  			scale_m = try[i];
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2104  			mode = SMIAPP_SCALING_MODE_BOTH;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2105  			best = this;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2106  		}
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2107  	}
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2108  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2109  	sel->r.width =
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2110  		(crops[CCS_PAD_SINK]->width
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2111  		 / scale_m
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2112  		 * CCS_LIM(sensor, SCALER_N_MIN)) & ~1;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2113  	if (mode == SMIAPP_SCALING_MODE_BOTH)
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2114  		sel->r.height =
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2115  			(crops[CCS_PAD_SINK]->height
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2116  			 / scale_m
3e158e1f1ec2ac drivers/media/i2c/smiapp/smiapp-core.c   Sakari Ailus 2020-02-10  2117  			 * CCS_LIM(sensor, SCALER_N_MIN))
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2118  			& ~1;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2119  	else
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2120  		sel->r.height = crops[CCS_PAD_SINK]->height;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2121  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2122  	if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2123  		sensor->scale_m = scale_m;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2124  		sensor->scaling_mode = mode;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2125  	}
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2126  }
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2127  /* We're only called on source pads. This function sets scaling. */
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2128  static int ccs_set_compose(struct v4l2_subdev *subdev,
f7234138f14c22 drivers/media/i2c/smiapp/smiapp-core.c   Hans Verkuil 2015-03-04  2129  			   struct v4l2_subdev_pad_config *cfg,
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2130  			   struct v4l2_subdev_selection *sel)
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2131  {
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2132  	struct ccs_sensor *sensor = to_ccs_sensor(subdev);
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2133  	struct ccs_subdev *ssd = to_ccs_subdev(subdev);
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2134  	struct v4l2_rect *comp, *crops[CCS_PADS];
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2135  
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2136  	ccs_get_crop_compose(subdev, cfg, crops, &comp, sel->which);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2137  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2138  	sel->r.top = 0;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2139  	sel->r.left = 0;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2140  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2141  	if (ssd == sensor->binner)
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2142  		ccs_set_compose_binner(subdev, cfg, sel, crops, comp);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2143  	else
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2144  		ccs_set_compose_scaler(subdev, cfg, sel, crops, comp);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2145  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2146  	*comp = sel->r;
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2147  	ccs_propagate(subdev, cfg, sel->which, V4L2_SEL_TGT_COMPOSE);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2148  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2149  	if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE)
161cc847370a92 drivers/media/i2c/smiapp/ccs-core.c      Sakari Ailus 2020-02-11  2150  		return ccs_pll_blanking_update(sensor);
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2151  
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2152  	return 0;
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2153  }
ccfc97bdb5ae8b drivers/media/video/smiapp/smiapp-core.c Sakari Ailus 2012-03-03  2154  

:::::: The code at line 2040 was first introduced by commit
:::::: 3e158e1f1ec2aca4287bc12323c7e88d4e3b4f38 media: smiapp: Switch to CCS limits

:::::: TO: Sakari Ailus <sakari.ailus@linux.intel.com>
:::::: CC: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35547 bytes --]

             reply	other threads:[~2021-09-13  7:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13  7:53 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-21  4:32 drivers/media/i2c/ccs/ccs-core.c:2040:3: warning: Division by zero [clang-analyzer-core.DivideZero] kernel test robot

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=202109131557.7TdynkZN-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.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 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.