* Re: [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model
@ 2022-08-02 23:12 kernel test robot
0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-08-02 23:12 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 25959 bytes --]
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/media/i2c/ov9282.c:1054:3: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]"
::::::
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220728130237.3396663-7-alexander.stein@ew.tq-group.com>
References: <20220728130237.3396663-7-alexander.stein@ew.tq-group.com>
TO: Alexander Stein <alexander.stein@ew.tq-group.com>
TO: "Paul J . Murphy" <paul.j.murphy@intel.com>
TO: Daniele Alessandrelli <daniele.alessandrelli@intel.com>
TO: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org
TO: Rob Herring <robh+dt@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
CC: Alexander Stein <alexander.stein@ew.tq-group.com>
CC: devicetree(a)vger.kernel.org
CC: Sakari Ailus <sakari.ailus@iki.fi>
Hi Alexander,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on media-tree/master]
[also build test WARNING on linus/master v5.19 next-20220728]
[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/Alexander-Stein/OV9281-support/20220728-210448
base: git://linuxtv.org/media_tree.git master
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: arm-randconfig-c002-20220731 (https://download.01.org/0day-ci/archive/20220803/202208030644.UFmtMaV9-lkp(a)intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 52cd00cabf479aa7eb6dbb063b7ba41ea57bce9e)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/ee28006553d4d23f600b0076ef6066710519f156
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Alexander-Stein/OV9281-support/20220728-210448
git checkout ee28006553d4d23f600b0076ef6066710519f156
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
include/linux/printk.h:690:2: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:674:3: note: expanded from macro 'printk_ratelimited'
printk(fmt, ##__VA_ARGS__); \
^
include/linux/printk.h:480:26: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^
include/linux/printk.h:451:3: note: expanded from macro 'printk_index_wrap'
__printk_index_emit(_fmt, NULL, NULL); \
^
include/linux/printk.h:426:34: note: expanded from macro '__printk_index_emit'
#define __printk_index_emit(...) do {} while (0)
^
include/linux/hid.h:1056:9: note: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'input')
input->name, c, type);
^
include/linux/printk.h:690:49: note: expanded from macro 'pr_warn_ratelimited'
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:674:17: note: expanded from macro 'printk_ratelimited'
printk(fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
include/linux/printk.h:480:60: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^~~~~~~~~~~
include/linux/printk.h:452:19: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
^~~~~~~~~~~
Suppressed 29 warnings (29 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
45 warnings generated.
drivers/hwmon/sht3x.c:268:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
return sprintf(buf, "%d\n", data->temperature);
^~~~~~~
drivers/hwmon/sht3x.c:268:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
return sprintf(buf, "%d\n", data->temperature);
^~~~~~~
drivers/hwmon/sht3x.c:279:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
return sprintf(buf, "%u\n", data->humidity);
^~~~~~~
drivers/hwmon/sht3x.c:279:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
return sprintf(buf, "%u\n", data->humidity);
^~~~~~~
drivers/hwmon/sht3x.c:356:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(position, commands->write_command, SHT3X_CMD_LENGTH);
^~~~~~
drivers/hwmon/sht3x.c:356:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(position, commands->write_command, SHT3X_CMD_LENGTH);
^~~~~~
Suppressed 42 warnings (42 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
42 warnings generated.
Suppressed 42 warnings (42 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
30 warnings generated.
drivers/input/joystick/magellan.c:144:2: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
snprintf(magellan->phys, sizeof(magellan->phys), "%s/input0", serio->phys);
^~~~~~~~
drivers/input/joystick/magellan.c:144:2: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
snprintf(magellan->phys, sizeof(magellan->phys), "%s/input0", serio->phys);
^~~~~~~~
Suppressed 29 warnings (29 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
36 warnings generated.
drivers/input/joystick/psxpad-spi.c:101:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(pad->sendbuf, PSX_CMD_ENTER_CFG, sizeof(PSX_CMD_ENTER_CFG));
^~~~~~
drivers/input/joystick/psxpad-spi.c:101:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(pad->sendbuf, PSX_CMD_ENTER_CFG, sizeof(PSX_CMD_ENTER_CFG));
^~~~~~
drivers/input/joystick/psxpad-spi.c:110:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(pad->sendbuf, PSX_CMD_ENABLE_MOTOR,
^~~~~~
drivers/input/joystick/psxpad-spi.c:110:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(pad->sendbuf, PSX_CMD_ENABLE_MOTOR,
^~~~~~
drivers/input/joystick/psxpad-spi.c:122:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(pad->sendbuf, PSX_CMD_EXIT_CFG, sizeof(PSX_CMD_EXIT_CFG));
^~~~~~
drivers/input/joystick/psxpad-spi.c:122:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(pad->sendbuf, PSX_CMD_EXIT_CFG, sizeof(PSX_CMD_EXIT_CFG));
^~~~~~
drivers/input/joystick/psxpad-spi.c:213:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(pad->sendbuf, PSX_CMD_POLL, sizeof(PSX_CMD_POLL));
^~~~~~
drivers/input/joystick/psxpad-spi.c:213:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(pad->sendbuf, PSX_CMD_POLL, sizeof(PSX_CMD_POLL));
^~~~~~
drivers/input/joystick/psxpad-spi.c:306:2: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
snprintf(pad->phys, sizeof(pad->phys), "%s/input", dev_name(&spi->dev));
^~~~~~~~
drivers/input/joystick/psxpad-spi.c:306:2: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
snprintf(pad->phys, sizeof(pad->phys), "%s/input", dev_name(&spi->dev));
^~~~~~~~
Suppressed 31 warnings (31 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
48 warnings generated.
>> drivers/media/i2c/ov9282.c:1054:3: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
return ret;
^ ~~~
drivers/media/i2c/ov9282.c:1041:2: note: 'ret' declared without an initial value
int ret;
^~~~~~~
drivers/media/i2c/ov9282.c:1044:6: note: Assuming 'ov9282' is non-null
if (!ov9282)
^~~~~~~
drivers/media/i2c/ov9282.c:1044:2: note: Taking false branch
if (!ov9282)
^
drivers/media/i2c/ov9282.c:1052:6: note: Assuming 'sensor_name' is null
if (!sensor_name) {
^~~~~~~~~~~~
drivers/media/i2c/ov9282.c:1052:2: note: Taking true branch
if (!sensor_name) {
^
drivers/media/i2c/ov9282.c:1053:3: note: Loop condition is false. Exiting loop
dev_err(ov9282->dev, "Sensor name is missing");
^
include/linux/dev_printk.h:144:2: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
include/linux/dev_printk.h:109:3: note: expanded from macro 'dev_printk_index_wrap'
dev_printk_index_emit(level, fmt); \
^
include/linux/dev_printk.h:105:2: note: expanded from macro 'dev_printk_index_emit'
printk_index_subsys_emit("%s %s: ", level, fmt)
^
include/linux/printk.h:447:2: note: expanded from macro 'printk_index_subsys_emit'
__printk_index_emit(fmt, level, subsys_fmt_prefix)
^
include/linux/printk.h:426:34: note: expanded from macro '__printk_index_emit'
#define __printk_index_emit(...) do {} while (0)
^
drivers/media/i2c/ov9282.c:1054:3: note: Undefined or garbage value returned to caller
return ret;
^ ~~~
Suppressed 47 warnings (45 in non-user code, 2 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
46 warnings generated.
Suppressed 46 warnings (45 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
47 warnings generated.
drivers/media/i2c/ov9650.c:606:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = ov965x_write(ov965x, REG_COM8, reg);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov9650.c:606:3: note: Value stored to 'ret' is never read
ret = ov965x_write(ov965x, REG_COM8, reg);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 46 warnings (45 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
50 warnings generated.
drivers/media/i2c/rdacm21.c:373:11: warning: The left operand of '==' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
if (val == OV10640_ID_HIGH)
^
drivers/media/i2c/rdacm21.c:550:6: note: Assuming 'dev' is non-null
if (!dev)
^~~~
drivers/media/i2c/rdacm21.c:550:2: note: Taking false branch
if (!dev)
^
drivers/media/i2c/rdacm21.c:557:6: note: 'ret' is >= 0
if (ret < 0) {
^~~
drivers/media/i2c/rdacm21.c:557:2: note: Taking false branch
if (ret < 0) {
^
drivers/media/i2c/rdacm21.c:564:2: note: Taking false branch
if (IS_ERR(dev->isp))
^
drivers/media/i2c/rdacm21.c:567:8: note: Calling 'rdacm21_initialize'
ret = rdacm21_initialize(dev);
^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/rdacm21.c:481:6: note: Assuming 'ret' is 0
if (ret)
^~~
drivers/media/i2c/rdacm21.c:481:2: note: Taking false branch
if (ret)
^
drivers/media/i2c/rdacm21.c:489:6: note: Assuming 'ret' is 0
if (ret)
^~~
drivers/media/i2c/rdacm21.c:489:2: note: Taking false branch
if (ret)
^
drivers/media/i2c/rdacm21.c:493:6: note: Assuming 'ret' is 0
if (ret)
^~~
drivers/media/i2c/rdacm21.c:493:2: note: Taking false branch
if (ret)
^
drivers/media/i2c/rdacm21.c:501:6: note: Assuming 'ret' is 0
if (ret)
^~~
drivers/media/i2c/rdacm21.c:501:2: note: Taking false branch
if (ret)
^
drivers/media/i2c/rdacm21.c:505:6: note: Assuming 'ret' is 0
if (ret)
vim +1054 drivers/media/i2c/ov9282.c
ded4a31a12fead Alexander Stein 2022-07-28 1030
14ea315bbeb75a Martina Krasteva 2021-05-27 1031 /**
14ea315bbeb75a Martina Krasteva 2021-05-27 1032 * ov9282_probe() - I2C client device binding
14ea315bbeb75a Martina Krasteva 2021-05-27 1033 * @client: pointer to i2c client device
14ea315bbeb75a Martina Krasteva 2021-05-27 1034 *
14ea315bbeb75a Martina Krasteva 2021-05-27 1035 * Return: 0 if successful, error code otherwise.
14ea315bbeb75a Martina Krasteva 2021-05-27 1036 */
14ea315bbeb75a Martina Krasteva 2021-05-27 1037 static int ov9282_probe(struct i2c_client *client)
14ea315bbeb75a Martina Krasteva 2021-05-27 1038 {
14ea315bbeb75a Martina Krasteva 2021-05-27 1039 struct ov9282 *ov9282;
ee28006553d4d2 Alexander Stein 2022-07-28 1040 const char *sensor_name;
14ea315bbeb75a Martina Krasteva 2021-05-27 1041 int ret;
14ea315bbeb75a Martina Krasteva 2021-05-27 1042
14ea315bbeb75a Martina Krasteva 2021-05-27 1043 ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282), GFP_KERNEL);
14ea315bbeb75a Martina Krasteva 2021-05-27 1044 if (!ov9282)
14ea315bbeb75a Martina Krasteva 2021-05-27 1045 return -ENOMEM;
14ea315bbeb75a Martina Krasteva 2021-05-27 1046
14ea315bbeb75a Martina Krasteva 2021-05-27 1047 ov9282->dev = &client->dev;
14ea315bbeb75a Martina Krasteva 2021-05-27 1048
14ea315bbeb75a Martina Krasteva 2021-05-27 1049 /* Initialize subdev */
14ea315bbeb75a Martina Krasteva 2021-05-27 1050 v4l2_i2c_subdev_init(&ov9282->sd, client, &ov9282_subdev_ops);
ee28006553d4d2 Alexander Stein 2022-07-28 1051 sensor_name = device_get_match_data(ov9282->dev);
ee28006553d4d2 Alexander Stein 2022-07-28 1052 if (!sensor_name) {
ee28006553d4d2 Alexander Stein 2022-07-28 1053 dev_err(ov9282->dev, "Sensor name is missing");
ee28006553d4d2 Alexander Stein 2022-07-28 @1054 return ret;
ee28006553d4d2 Alexander Stein 2022-07-28 1055 }
ee28006553d4d2 Alexander Stein 2022-07-28 1056 v4l2_i2c_subdev_set_name(&ov9282->sd, client, sensor_name, NULL);
14ea315bbeb75a Martina Krasteva 2021-05-27 1057
14ea315bbeb75a Martina Krasteva 2021-05-27 1058 ret = ov9282_parse_hw_config(ov9282);
14ea315bbeb75a Martina Krasteva 2021-05-27 1059 if (ret) {
14ea315bbeb75a Martina Krasteva 2021-05-27 1060 dev_err(ov9282->dev, "HW configuration is not supported");
14ea315bbeb75a Martina Krasteva 2021-05-27 1061 return ret;
14ea315bbeb75a Martina Krasteva 2021-05-27 1062 }
14ea315bbeb75a Martina Krasteva 2021-05-27 1063
ded4a31a12fead Alexander Stein 2022-07-28 1064 ret = ov9282_get_regulators(ov9282);
ded4a31a12fead Alexander Stein 2022-07-28 1065 if (ret) {
ded4a31a12fead Alexander Stein 2022-07-28 1066 dev_err(&client->dev, "Failed to get power regulators\n");
ded4a31a12fead Alexander Stein 2022-07-28 1067 return ret;
ded4a31a12fead Alexander Stein 2022-07-28 1068 }
ded4a31a12fead Alexander Stein 2022-07-28 1069
14ea315bbeb75a Martina Krasteva 2021-05-27 1070 mutex_init(&ov9282->mutex);
14ea315bbeb75a Martina Krasteva 2021-05-27 1071
14ea315bbeb75a Martina Krasteva 2021-05-27 1072 ret = ov9282_power_on(ov9282->dev);
14ea315bbeb75a Martina Krasteva 2021-05-27 1073 if (ret) {
14ea315bbeb75a Martina Krasteva 2021-05-27 1074 dev_err(ov9282->dev, "failed to power-on the sensor");
14ea315bbeb75a Martina Krasteva 2021-05-27 1075 goto error_mutex_destroy;
14ea315bbeb75a Martina Krasteva 2021-05-27 1076 }
14ea315bbeb75a Martina Krasteva 2021-05-27 1077
14ea315bbeb75a Martina Krasteva 2021-05-27 1078 /* Check module identity */
14ea315bbeb75a Martina Krasteva 2021-05-27 1079 ret = ov9282_detect(ov9282);
14ea315bbeb75a Martina Krasteva 2021-05-27 1080 if (ret) {
14ea315bbeb75a Martina Krasteva 2021-05-27 1081 dev_err(ov9282->dev, "failed to find sensor: %d", ret);
14ea315bbeb75a Martina Krasteva 2021-05-27 1082 goto error_power_off;
14ea315bbeb75a Martina Krasteva 2021-05-27 1083 }
14ea315bbeb75a Martina Krasteva 2021-05-27 1084
14ea315bbeb75a Martina Krasteva 2021-05-27 1085 /* Set default mode to max resolution */
14ea315bbeb75a Martina Krasteva 2021-05-27 1086 ov9282->cur_mode = &supported_mode;
14ea315bbeb75a Martina Krasteva 2021-05-27 1087 ov9282->vblank = ov9282->cur_mode->vblank;
14ea315bbeb75a Martina Krasteva 2021-05-27 1088
14ea315bbeb75a Martina Krasteva 2021-05-27 1089 ret = ov9282_init_controls(ov9282);
14ea315bbeb75a Martina Krasteva 2021-05-27 1090 if (ret) {
14ea315bbeb75a Martina Krasteva 2021-05-27 1091 dev_err(ov9282->dev, "failed to init controls: %d", ret);
14ea315bbeb75a Martina Krasteva 2021-05-27 1092 goto error_power_off;
14ea315bbeb75a Martina Krasteva 2021-05-27 1093 }
14ea315bbeb75a Martina Krasteva 2021-05-27 1094
14ea315bbeb75a Martina Krasteva 2021-05-27 1095 /* Initialize subdev */
14ea315bbeb75a Martina Krasteva 2021-05-27 1096 ov9282->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
14ea315bbeb75a Martina Krasteva 2021-05-27 1097 ov9282->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
14ea315bbeb75a Martina Krasteva 2021-05-27 1098
14ea315bbeb75a Martina Krasteva 2021-05-27 1099 /* Initialize source pad */
14ea315bbeb75a Martina Krasteva 2021-05-27 1100 ov9282->pad.flags = MEDIA_PAD_FL_SOURCE;
14ea315bbeb75a Martina Krasteva 2021-05-27 1101 ret = media_entity_pads_init(&ov9282->sd.entity, 1, &ov9282->pad);
14ea315bbeb75a Martina Krasteva 2021-05-27 1102 if (ret) {
14ea315bbeb75a Martina Krasteva 2021-05-27 1103 dev_err(ov9282->dev, "failed to init entity pads: %d", ret);
14ea315bbeb75a Martina Krasteva 2021-05-27 1104 goto error_handler_free;
14ea315bbeb75a Martina Krasteva 2021-05-27 1105 }
14ea315bbeb75a Martina Krasteva 2021-05-27 1106
14ea315bbeb75a Martina Krasteva 2021-05-27 1107 ret = v4l2_async_register_subdev_sensor(&ov9282->sd);
14ea315bbeb75a Martina Krasteva 2021-05-27 1108 if (ret < 0) {
14ea315bbeb75a Martina Krasteva 2021-05-27 1109 dev_err(ov9282->dev,
14ea315bbeb75a Martina Krasteva 2021-05-27 1110 "failed to register async subdev: %d", ret);
14ea315bbeb75a Martina Krasteva 2021-05-27 1111 goto error_media_entity;
14ea315bbeb75a Martina Krasteva 2021-05-27 1112 }
14ea315bbeb75a Martina Krasteva 2021-05-27 1113
14ea315bbeb75a Martina Krasteva 2021-05-27 1114 pm_runtime_set_active(ov9282->dev);
14ea315bbeb75a Martina Krasteva 2021-05-27 1115 pm_runtime_enable(ov9282->dev);
14ea315bbeb75a Martina Krasteva 2021-05-27 1116 pm_runtime_idle(ov9282->dev);
14ea315bbeb75a Martina Krasteva 2021-05-27 1117
14ea315bbeb75a Martina Krasteva 2021-05-27 1118 return 0;
14ea315bbeb75a Martina Krasteva 2021-05-27 1119
14ea315bbeb75a Martina Krasteva 2021-05-27 1120 error_media_entity:
14ea315bbeb75a Martina Krasteva 2021-05-27 1121 media_entity_cleanup(&ov9282->sd.entity);
14ea315bbeb75a Martina Krasteva 2021-05-27 1122 error_handler_free:
14ea315bbeb75a Martina Krasteva 2021-05-27 1123 v4l2_ctrl_handler_free(ov9282->sd.ctrl_handler);
14ea315bbeb75a Martina Krasteva 2021-05-27 1124 error_power_off:
14ea315bbeb75a Martina Krasteva 2021-05-27 1125 ov9282_power_off(ov9282->dev);
14ea315bbeb75a Martina Krasteva 2021-05-27 1126 error_mutex_destroy:
14ea315bbeb75a Martina Krasteva 2021-05-27 1127 mutex_destroy(&ov9282->mutex);
14ea315bbeb75a Martina Krasteva 2021-05-27 1128
14ea315bbeb75a Martina Krasteva 2021-05-27 1129 return ret;
14ea315bbeb75a Martina Krasteva 2021-05-27 1130 }
14ea315bbeb75a Martina Krasteva 2021-05-27 1131
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v4 0/7] OV9281 support
@ 2022-07-28 13:02 Alexander Stein
2022-07-28 13:02 ` [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model Alexander Stein
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Stein @ 2022-07-28 13:02 UTC (permalink / raw)
To: Paul J . Murphy, Daniele Alessandrelli, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski
Cc: Alexander Stein, linux-media, devicetree, Sakari Ailus
Hi,
this is the 4th series adding support for OV9281 which is quite similar to OV9282.
This includes:
* a small cleanup (Patch 1)
* adding a new compatible (Patch 2 & 3)
* adding support for regulators (Patch 4 & 5)
* Fixing v4l2 subdev name depending on actual model name (Patch 6)
* Add regmap support (Patch 7)
Thanks for anyone doing review and giving a feedback.
Here are the changes in v4:
* Use platform data to set sensor name (Patch 6)
* Fixed some style issues (Patch 7)
Here are the changes in v3:
* Removed struct field documentation as well (Patch 1)
* Dropped v2 Patch 6 (wrong approach)
* Added new Patch 6 to set subdev name according to model parsed form compatible
* Added new Patch 7 adding regmap support
This is a preparation to solve the defunct auto-increment using regmap's
'use_single_read' (still WIP)
Here are the changes in v2:
* Added Krzysztof's a-b for Patch 2 & 4
* Added Daniele's a-b for Patch 1 & 3
* Removed additional error message in ov9282_power_off
* Renamed function from ov9282_configure_regulators to ov9282_get_regulators
* Cleaned-up reading ID registers
The regulator support is based on the driver from Raspberry Pi downstream kernel
[1], the ID register read fix as well. Please refer to [2] why this fix is
required. I can confirm this is necessary by checking with a Logic analyzer on
the i2c bus.
Best regards,
Alexander
[1] https://github.com/raspberrypi/linux/blob/rpi-5.15.y/drivers/media/i2c/ov9281.c
[2] https://github.com/raspberrypi/linux/commit/58deee7c917e1c3c5e37987c3a89ad19d791f58a
Alexander Stein (7):
media: i2c: ov9282: remove unused and unset i2c_client member
media: dt-bindings: media: Add compatible for ov9281
media: i2c: ov9282: Add ov9281 compatible
media: dt-bindings: media: ov9282: Add power supply properties
media: i2c: ov9282: Add regulator support
media: i2c: ov9282: Set v4l2 subdev name according to sensor model
media: i2c: ov9282: Add regmap support
.../bindings/media/i2c/ovti,ov9282.yaml | 14 ++-
drivers/media/i2c/ov9282.c | 108 ++++++++++++------
2 files changed, 89 insertions(+), 33 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model
2022-07-28 13:02 [PATCH v4 0/7] OV9281 support Alexander Stein
@ 2022-07-28 13:02 ` Alexander Stein
2022-07-28 21:10 ` kernel test robot
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Stein @ 2022-07-28 13:02 UTC (permalink / raw)
To: Paul J . Murphy, Daniele Alessandrelli, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski
Cc: Alexander Stein, linux-media, devicetree, Sakari Ailus
To distinguish ov9281 & ov9282 the name has to be explicitly set.
Provide a fixed string using platform data.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
Changes in v4:
* Replaced v4l2_i2c_subdev_set_name with device_get_match_data and added
platform data containing the sensor name
drivers/media/i2c/ov9282.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c
index 352dbe21a902..f79bdfa821e8 100644
--- a/drivers/media/i2c/ov9282.c
+++ b/drivers/media/i2c/ov9282.c
@@ -1037,6 +1037,7 @@ static int ov9282_get_regulators(struct ov9282 *ov9282)
static int ov9282_probe(struct i2c_client *client)
{
struct ov9282 *ov9282;
+ const char *sensor_name;
int ret;
ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282), GFP_KERNEL);
@@ -1047,6 +1048,12 @@ static int ov9282_probe(struct i2c_client *client)
/* Initialize subdev */
v4l2_i2c_subdev_init(&ov9282->sd, client, &ov9282_subdev_ops);
+ sensor_name = device_get_match_data(ov9282->dev);
+ if (!sensor_name) {
+ dev_err(ov9282->dev, "Sensor name is missing");
+ return ret;
+ }
+ v4l2_i2c_subdev_set_name(&ov9282->sd, client, sensor_name, NULL);
ret = ov9282_parse_hw_config(ov9282);
if (ret) {
@@ -1152,8 +1159,8 @@ static const struct dev_pm_ops ov9282_pm_ops = {
};
static const struct of_device_id ov9282_of_match[] = {
- { .compatible = "ovti,ov9281" },
- { .compatible = "ovti,ov9282" },
+ { .compatible = "ovti,ov9281", .data = "ov9281" },
+ { .compatible = "ovti,ov9282", .data = "ov9282" },
{ }
};
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model
2022-07-28 13:02 ` [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model Alexander Stein
@ 2022-07-28 21:10 ` kernel test robot
2022-07-29 8:23 ` Alexander Stein
0 siblings, 1 reply; 7+ messages in thread
From: kernel test robot @ 2022-07-28 21:10 UTC (permalink / raw)
To: Alexander Stein, Paul J . Murphy, Daniele Alessandrelli,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski
Cc: llvm, kbuild-all, linux-media, Alexander Stein, devicetree,
Sakari Ailus
Hi Alexander,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on media-tree/master]
[also build test WARNING on linus/master v5.19-rc8 next-20220728]
[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/Alexander-Stein/OV9281-support/20220728-210448
base: git://linuxtv.org/media_tree.git master
config: arm-randconfig-r022-20220728 (https://download.01.org/0day-ci/archive/20220729/202207290518.1D7MVS65-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 8dfaecc4c24494337933aff9d9166486ca0949f1)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/ee28006553d4d23f600b0076ef6066710519f156
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Alexander-Stein/OV9281-support/20220728-210448
git checkout ee28006553d4d23f600b0076ef6066710519f156
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/media/i2c/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/media/i2c/ov9282.c:1054:10: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
return ret;
^~~
drivers/media/i2c/ov9282.c:1041:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
1 warning generated.
vim +/ret +1054 drivers/media/i2c/ov9282.c
1030
1031 /**
1032 * ov9282_probe() - I2C client device binding
1033 * @client: pointer to i2c client device
1034 *
1035 * Return: 0 if successful, error code otherwise.
1036 */
1037 static int ov9282_probe(struct i2c_client *client)
1038 {
1039 struct ov9282 *ov9282;
1040 const char *sensor_name;
1041 int ret;
1042
1043 ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282), GFP_KERNEL);
1044 if (!ov9282)
1045 return -ENOMEM;
1046
1047 ov9282->dev = &client->dev;
1048
1049 /* Initialize subdev */
1050 v4l2_i2c_subdev_init(&ov9282->sd, client, &ov9282_subdev_ops);
1051 sensor_name = device_get_match_data(ov9282->dev);
1052 if (!sensor_name) {
1053 dev_err(ov9282->dev, "Sensor name is missing");
> 1054 return ret;
1055 }
1056 v4l2_i2c_subdev_set_name(&ov9282->sd, client, sensor_name, NULL);
1057
1058 ret = ov9282_parse_hw_config(ov9282);
1059 if (ret) {
1060 dev_err(ov9282->dev, "HW configuration is not supported");
1061 return ret;
1062 }
1063
1064 ret = ov9282_get_regulators(ov9282);
1065 if (ret) {
1066 dev_err(&client->dev, "Failed to get power regulators\n");
1067 return ret;
1068 }
1069
1070 mutex_init(&ov9282->mutex);
1071
1072 ret = ov9282_power_on(ov9282->dev);
1073 if (ret) {
1074 dev_err(ov9282->dev, "failed to power-on the sensor");
1075 goto error_mutex_destroy;
1076 }
1077
1078 /* Check module identity */
1079 ret = ov9282_detect(ov9282);
1080 if (ret) {
1081 dev_err(ov9282->dev, "failed to find sensor: %d", ret);
1082 goto error_power_off;
1083 }
1084
1085 /* Set default mode to max resolution */
1086 ov9282->cur_mode = &supported_mode;
1087 ov9282->vblank = ov9282->cur_mode->vblank;
1088
1089 ret = ov9282_init_controls(ov9282);
1090 if (ret) {
1091 dev_err(ov9282->dev, "failed to init controls: %d", ret);
1092 goto error_power_off;
1093 }
1094
1095 /* Initialize subdev */
1096 ov9282->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1097 ov9282->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
1098
1099 /* Initialize source pad */
1100 ov9282->pad.flags = MEDIA_PAD_FL_SOURCE;
1101 ret = media_entity_pads_init(&ov9282->sd.entity, 1, &ov9282->pad);
1102 if (ret) {
1103 dev_err(ov9282->dev, "failed to init entity pads: %d", ret);
1104 goto error_handler_free;
1105 }
1106
1107 ret = v4l2_async_register_subdev_sensor(&ov9282->sd);
1108 if (ret < 0) {
1109 dev_err(ov9282->dev,
1110 "failed to register async subdev: %d", ret);
1111 goto error_media_entity;
1112 }
1113
1114 pm_runtime_set_active(ov9282->dev);
1115 pm_runtime_enable(ov9282->dev);
1116 pm_runtime_idle(ov9282->dev);
1117
1118 return 0;
1119
1120 error_media_entity:
1121 media_entity_cleanup(&ov9282->sd.entity);
1122 error_handler_free:
1123 v4l2_ctrl_handler_free(ov9282->sd.ctrl_handler);
1124 error_power_off:
1125 ov9282_power_off(ov9282->dev);
1126 error_mutex_destroy:
1127 mutex_destroy(&ov9282->mutex);
1128
1129 return ret;
1130 }
1131
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model
2022-07-28 21:10 ` kernel test robot
@ 2022-07-29 8:23 ` Alexander Stein
0 siblings, 0 replies; 7+ messages in thread
From: Alexander Stein @ 2022-07-29 8:23 UTC (permalink / raw)
To: Paul J . Murphy, Daniele Alessandrelli, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, kernel test robot
Cc: llvm, kbuild-all, linux-media, devicetree, Sakari Ailus
Am Donnerstag, 28. Juli 2022, 23:10:07 CEST schrieb kernel test robot:
> Hi Alexander,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on media-tree/master]
> [also build test WARNING on linus/master v5.19-rc8 next-20220728]
> [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/Alexander-Stein/OV9281-suppo
> rt/20220728-210448 base: git://linuxtv.org/media_tree.git master
> config: arm-randconfig-r022-20220728
> (https://download.01.org/0day-ci/archive/20220729/202207290518.1D7MVS65-lkp
> @intel.com/config) compiler: clang version 15.0.0
> (https://github.com/llvm/llvm-project
> 8dfaecc4c24494337933aff9d9166486ca0949f1) 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 arm cross compiling tool for clang build
> # apt-get install binutils-arm-linux-gnueabi
> #
> https://github.com/intel-lab-lkp/linux/commit/ee28006553d4d23f600b0076ef606
> 6710519f156 git remote add linux-review
> https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review
> Alexander-Stein/OV9281-support/20220728-210448 git checkout
> ee28006553d4d23f600b0076ef6066710519f156
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1
> O=build_dir ARCH=arm SHELL=/bin/bash drivers/media/i2c/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
> >> drivers/media/i2c/ov9282.c:1054:10: warning: variable 'ret' is
> >> uninitialized when used here [-Wuninitialized]
> return ret;
> ^~~
> drivers/media/i2c/ov9282.c:1041:9: note: initialize the variable 'ret' to
> silence this warning int ret;
> ^
> = 0
> 1 warning generated.
>
>
> vim +/ret +1054 drivers/media/i2c/ov9282.c
>
> 1030
> 1031 /**
> 1032 * ov9282_probe() - I2C client device binding
> 1033 * @client: pointer to i2c client device
> 1034 *
> 1035 * Return: 0 if successful, error code otherwise.
> 1036 */
> 1037 static int ov9282_probe(struct i2c_client *client)
> 1038 {
> 1039 struct ov9282 *ov9282;
> 1040 const char *sensor_name;
> 1041 int ret;
> 1042
> 1043 ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282),
GFP_KERNEL);
> 1044 if (!ov9282)
> 1045 return -ENOMEM;
> 1046
> 1047 ov9282->dev = &client->dev;
> 1048
> 1049 /* Initialize subdev */
> 1050 v4l2_i2c_subdev_init(&ov9282->sd, client,
&ov9282_subdev_ops);
> 1051 sensor_name = device_get_match_data(ov9282->dev);
> 1052 if (!sensor_name) {
> 1053 dev_err(ov9282->dev, "Sensor name is
missing");
>
> > 1054 return ret;
>
> 1055 }
> 1056 v4l2_i2c_subdev_set_name(&ov9282->sd, client,
sensor_name, NULL);
> 1057
> 1058 ret = ov9282_parse_hw_config(ov9282);
> 1059 if (ret) {
> 1060 dev_err(ov9282->dev, "HW configuration is not
supported");
> 1061 return ret;
> 1062 }
> 1063
> 1064 ret = ov9282_get_regulators(ov9282);
> 1065 if (ret) {
> 1066 dev_err(&client->dev, "Failed to get power
regulators\n");
> 1067 return ret;
> 1068 }
> 1069
> 1070 mutex_init(&ov9282->mutex);
> 1071
> 1072 ret = ov9282_power_on(ov9282->dev);
> 1073 if (ret) {
> 1074 dev_err(ov9282->dev, "failed to power-on the
sensor");
> 1075 goto error_mutex_destroy;
> 1076 }
> 1077
> 1078 /* Check module identity */
> 1079 ret = ov9282_detect(ov9282);
> 1080 if (ret) {
> 1081 dev_err(ov9282->dev, "failed to find sensor:
%d", ret);
> 1082 goto error_power_off;
> 1083 }
> 1084
> 1085 /* Set default mode to max resolution */
> 1086 ov9282->cur_mode = &supported_mode;
> 1087 ov9282->vblank = ov9282->cur_mode->vblank;
> 1088
> 1089 ret = ov9282_init_controls(ov9282);
> 1090 if (ret) {
> 1091 dev_err(ov9282->dev, "failed to init
controls: %d", ret);
> 1092 goto error_power_off;
> 1093 }
> 1094
> 1095 /* Initialize subdev */
> 1096 ov9282->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> 1097 ov9282->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
> 1098
> 1099 /* Initialize source pad */
> 1100 ov9282->pad.flags = MEDIA_PAD_FL_SOURCE;
> 1101 ret = media_entity_pads_init(&ov9282->sd.entity, 1,
&ov9282->pad);
> 1102 if (ret) {
> 1103 dev_err(ov9282->dev, "failed to init entity
pads: %d", ret);
> 1104 goto error_handler_free;
> 1105 }
> 1106
> 1107 ret = v4l2_async_register_subdev_sensor(&ov9282->sd);
> 1108 if (ret < 0) {
> 1109 dev_err(ov9282->dev,
> 1110 "failed to register async subdev:
%d", ret);
> 1111 goto error_media_entity;
> 1112 }
> 1113
> 1114 pm_runtime_set_active(ov9282->dev);
> 1115 pm_runtime_enable(ov9282->dev);
> 1116 pm_runtime_idle(ov9282->dev);
> 1117
> 1118 return 0;
> 1119
> 1120 error_media_entity:
> 1121 media_entity_cleanup(&ov9282->sd.entity);
> 1122 error_handler_free:
> 1123 v4l2_ctrl_handler_free(ov9282->sd.ctrl_handler);
> 1124 error_power_off:
> 1125 ov9282_power_off(ov9282->dev);
> 1126 error_mutex_destroy:
> 1127 mutex_destroy(&ov9282->mutex);
> 1128
> 1129 return ret;
> 1130 }
> 1131
Meh, I'll come up with a fixed once discussion about the additional compatible
has settled. This will also include the missing member documentation in patch
5
Best regards,
Alexander
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model
@ 2022-07-29 8:23 ` Alexander Stein
0 siblings, 0 replies; 7+ messages in thread
From: Alexander Stein @ 2022-07-29 8:23 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6030 bytes --]
Am Donnerstag, 28. Juli 2022, 23:10:07 CEST schrieb kernel test robot:
> Hi Alexander,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on media-tree/master]
> [also build test WARNING on linus/master v5.19-rc8 next-20220728]
> [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/Alexander-Stein/OV9281-suppo
> rt/20220728-210448 base: git://linuxtv.org/media_tree.git master
> config: arm-randconfig-r022-20220728
> (https://download.01.org/0day-ci/archive/20220729/202207290518.1D7MVS65-lkp
> @intel.com/config) compiler: clang version 15.0.0
> (https://github.com/llvm/llvm-project
> 8dfaecc4c24494337933aff9d9166486ca0949f1) 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 arm cross compiling tool for clang build
> # apt-get install binutils-arm-linux-gnueabi
> #
> https://github.com/intel-lab-lkp/linux/commit/ee28006553d4d23f600b0076ef606
> 6710519f156 git remote add linux-review
> https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review
> Alexander-Stein/OV9281-support/20220728-210448 git checkout
> ee28006553d4d23f600b0076ef6066710519f156
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1
> O=build_dir ARCH=arm SHELL=/bin/bash drivers/media/i2c/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
> >> drivers/media/i2c/ov9282.c:1054:10: warning: variable 'ret' is
> >> uninitialized when used here [-Wuninitialized]
> return ret;
> ^~~
> drivers/media/i2c/ov9282.c:1041:9: note: initialize the variable 'ret' to
> silence this warning int ret;
> ^
> = 0
> 1 warning generated.
>
>
> vim +/ret +1054 drivers/media/i2c/ov9282.c
>
> 1030
> 1031 /**
> 1032 * ov9282_probe() - I2C client device binding
> 1033 * @client: pointer to i2c client device
> 1034 *
> 1035 * Return: 0 if successful, error code otherwise.
> 1036 */
> 1037 static int ov9282_probe(struct i2c_client *client)
> 1038 {
> 1039 struct ov9282 *ov9282;
> 1040 const char *sensor_name;
> 1041 int ret;
> 1042
> 1043 ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282),
GFP_KERNEL);
> 1044 if (!ov9282)
> 1045 return -ENOMEM;
> 1046
> 1047 ov9282->dev = &client->dev;
> 1048
> 1049 /* Initialize subdev */
> 1050 v4l2_i2c_subdev_init(&ov9282->sd, client,
&ov9282_subdev_ops);
> 1051 sensor_name = device_get_match_data(ov9282->dev);
> 1052 if (!sensor_name) {
> 1053 dev_err(ov9282->dev, "Sensor name is
missing");
>
> > 1054 return ret;
>
> 1055 }
> 1056 v4l2_i2c_subdev_set_name(&ov9282->sd, client,
sensor_name, NULL);
> 1057
> 1058 ret = ov9282_parse_hw_config(ov9282);
> 1059 if (ret) {
> 1060 dev_err(ov9282->dev, "HW configuration is not
supported");
> 1061 return ret;
> 1062 }
> 1063
> 1064 ret = ov9282_get_regulators(ov9282);
> 1065 if (ret) {
> 1066 dev_err(&client->dev, "Failed to get power
regulators\n");
> 1067 return ret;
> 1068 }
> 1069
> 1070 mutex_init(&ov9282->mutex);
> 1071
> 1072 ret = ov9282_power_on(ov9282->dev);
> 1073 if (ret) {
> 1074 dev_err(ov9282->dev, "failed to power-on the
sensor");
> 1075 goto error_mutex_destroy;
> 1076 }
> 1077
> 1078 /* Check module identity */
> 1079 ret = ov9282_detect(ov9282);
> 1080 if (ret) {
> 1081 dev_err(ov9282->dev, "failed to find sensor:
%d", ret);
> 1082 goto error_power_off;
> 1083 }
> 1084
> 1085 /* Set default mode to max resolution */
> 1086 ov9282->cur_mode = &supported_mode;
> 1087 ov9282->vblank = ov9282->cur_mode->vblank;
> 1088
> 1089 ret = ov9282_init_controls(ov9282);
> 1090 if (ret) {
> 1091 dev_err(ov9282->dev, "failed to init
controls: %d", ret);
> 1092 goto error_power_off;
> 1093 }
> 1094
> 1095 /* Initialize subdev */
> 1096 ov9282->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> 1097 ov9282->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
> 1098
> 1099 /* Initialize source pad */
> 1100 ov9282->pad.flags = MEDIA_PAD_FL_SOURCE;
> 1101 ret = media_entity_pads_init(&ov9282->sd.entity, 1,
&ov9282->pad);
> 1102 if (ret) {
> 1103 dev_err(ov9282->dev, "failed to init entity
pads: %d", ret);
> 1104 goto error_handler_free;
> 1105 }
> 1106
> 1107 ret = v4l2_async_register_subdev_sensor(&ov9282->sd);
> 1108 if (ret < 0) {
> 1109 dev_err(ov9282->dev,
> 1110 "failed to register async subdev:
%d", ret);
> 1111 goto error_media_entity;
> 1112 }
> 1113
> 1114 pm_runtime_set_active(ov9282->dev);
> 1115 pm_runtime_enable(ov9282->dev);
> 1116 pm_runtime_idle(ov9282->dev);
> 1117
> 1118 return 0;
> 1119
> 1120 error_media_entity:
> 1121 media_entity_cleanup(&ov9282->sd.entity);
> 1122 error_handler_free:
> 1123 v4l2_ctrl_handler_free(ov9282->sd.ctrl_handler);
> 1124 error_power_off:
> 1125 ov9282_power_off(ov9282->dev);
> 1126 error_mutex_destroy:
> 1127 mutex_destroy(&ov9282->mutex);
> 1128
> 1129 return ret;
> 1130 }
> 1131
Meh, I'll come up with a fixed once discussion about the additional compatible
has settled. This will also include the missing member documentation in patch
5
Best regards,
Alexander
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model
2022-07-29 8:23 ` Alexander Stein
@ 2022-08-01 12:16 ` Sakari Ailus
-1 siblings, 0 replies; 7+ messages in thread
From: Sakari Ailus @ 2022-08-01 12:16 UTC (permalink / raw)
To: Alexander Stein
Cc: Paul J . Murphy, Daniele Alessandrelli, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, kernel test robot, llvm,
kbuild-all, linux-media, devicetree
Hi Alexander,
On Fri, Jul 29, 2022 at 10:23:48AM +0200, Alexander Stein wrote:
> Am Donnerstag, 28. Juli 2022, 23:10:07 CEST schrieb kernel test robot:
> > Hi Alexander,
> >
> > Thank you for the patch! Perhaps something to improve:
> >
> > [auto build test WARNING on media-tree/master]
> > [also build test WARNING on linus/master v5.19-rc8 next-20220728]
> > [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/Alexander-Stein/OV9281-suppo
> > rt/20220728-210448 base: git://linuxtv.org/media_tree.git master
> > config: arm-randconfig-r022-20220728
> > (https://download.01.org/0day-ci/archive/20220729/202207290518.1D7MVS65-lkp
> > @intel.com/config) compiler: clang version 15.0.0
> > (https://github.com/llvm/llvm-project
> > 8dfaecc4c24494337933aff9d9166486ca0949f1) 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 arm cross compiling tool for clang build
> > # apt-get install binutils-arm-linux-gnueabi
> > #
> > https://github.com/intel-lab-lkp/linux/commit/ee28006553d4d23f600b0076ef606
> > 6710519f156 git remote add linux-review
> > https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review
> > Alexander-Stein/OV9281-support/20220728-210448 git checkout
> > ee28006553d4d23f600b0076ef6066710519f156
> > # save the config file
> > mkdir build_dir && cp config build_dir/.config
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1
> > O=build_dir ARCH=arm SHELL=/bin/bash drivers/media/i2c/
> >
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> > >> drivers/media/i2c/ov9282.c:1054:10: warning: variable 'ret' is
> > >> uninitialized when used here [-Wuninitialized]
> > return ret;
> > ^~~
> > drivers/media/i2c/ov9282.c:1041:9: note: initialize the variable 'ret' to
> > silence this warning int ret;
> > ^
> > = 0
> > 1 warning generated.
> >
> >
> > vim +/ret +1054 drivers/media/i2c/ov9282.c
> >
> > 1030
> > 1031 /**
> > 1032 * ov9282_probe() - I2C client device binding
> > 1033 * @client: pointer to i2c client device
> > 1034 *
> > 1035 * Return: 0 if successful, error code otherwise.
> > 1036 */
> > 1037 static int ov9282_probe(struct i2c_client *client)
> > 1038 {
> > 1039 struct ov9282 *ov9282;
> > 1040 const char *sensor_name;
> > 1041 int ret;
> > 1042
> > 1043 ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282),
> GFP_KERNEL);
> > 1044 if (!ov9282)
> > 1045 return -ENOMEM;
> > 1046
> > 1047 ov9282->dev = &client->dev;
> > 1048
> > 1049 /* Initialize subdev */
> > 1050 v4l2_i2c_subdev_init(&ov9282->sd, client,
> &ov9282_subdev_ops);
> > 1051 sensor_name = device_get_match_data(ov9282->dev);
> > 1052 if (!sensor_name) {
> > 1053 dev_err(ov9282->dev, "Sensor name is
> missing");
> >
> > > 1054 return ret;
> >
> > 1055 }
> > 1056 v4l2_i2c_subdev_set_name(&ov9282->sd, client,
> sensor_name, NULL);
> > 1057
> > 1058 ret = ov9282_parse_hw_config(ov9282);
> > 1059 if (ret) {
> > 1060 dev_err(ov9282->dev, "HW configuration is not
> supported");
> > 1061 return ret;
> > 1062 }
> > 1063
> > 1064 ret = ov9282_get_regulators(ov9282);
> > 1065 if (ret) {
> > 1066 dev_err(&client->dev, "Failed to get power
> regulators\n");
> > 1067 return ret;
> > 1068 }
> > 1069
> > 1070 mutex_init(&ov9282->mutex);
> > 1071
> > 1072 ret = ov9282_power_on(ov9282->dev);
> > 1073 if (ret) {
> > 1074 dev_err(ov9282->dev, "failed to power-on the
> sensor");
> > 1075 goto error_mutex_destroy;
> > 1076 }
> > 1077
> > 1078 /* Check module identity */
> > 1079 ret = ov9282_detect(ov9282);
> > 1080 if (ret) {
> > 1081 dev_err(ov9282->dev, "failed to find sensor:
> %d", ret);
> > 1082 goto error_power_off;
> > 1083 }
> > 1084
> > 1085 /* Set default mode to max resolution */
> > 1086 ov9282->cur_mode = &supported_mode;
> > 1087 ov9282->vblank = ov9282->cur_mode->vblank;
> > 1088
> > 1089 ret = ov9282_init_controls(ov9282);
> > 1090 if (ret) {
> > 1091 dev_err(ov9282->dev, "failed to init
> controls: %d", ret);
> > 1092 goto error_power_off;
> > 1093 }
> > 1094
> > 1095 /* Initialize subdev */
> > 1096 ov9282->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> > 1097 ov9282->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
> > 1098
> > 1099 /* Initialize source pad */
> > 1100 ov9282->pad.flags = MEDIA_PAD_FL_SOURCE;
> > 1101 ret = media_entity_pads_init(&ov9282->sd.entity, 1,
> &ov9282->pad);
> > 1102 if (ret) {
> > 1103 dev_err(ov9282->dev, "failed to init entity
> pads: %d", ret);
> > 1104 goto error_handler_free;
> > 1105 }
> > 1106
> > 1107 ret = v4l2_async_register_subdev_sensor(&ov9282->sd);
> > 1108 if (ret < 0) {
> > 1109 dev_err(ov9282->dev,
> > 1110 "failed to register async subdev:
> %d", ret);
> > 1111 goto error_media_entity;
> > 1112 }
> > 1113
> > 1114 pm_runtime_set_active(ov9282->dev);
> > 1115 pm_runtime_enable(ov9282->dev);
> > 1116 pm_runtime_idle(ov9282->dev);
> > 1117
> > 1118 return 0;
> > 1119
> > 1120 error_media_entity:
> > 1121 media_entity_cleanup(&ov9282->sd.entity);
> > 1122 error_handler_free:
> > 1123 v4l2_ctrl_handler_free(ov9282->sd.ctrl_handler);
> > 1124 error_power_off:
> > 1125 ov9282_power_off(ov9282->dev);
> > 1126 error_mutex_destroy:
> > 1127 mutex_destroy(&ov9282->mutex);
> > 1128
> > 1129 return ret;
> > 1130 }
> > 1131
>
> Meh, I'll come up with a fixed once discussion about the additional compatible
> has settled. This will also include the missing member documentation in patch
> 5
I think you could simply pass device_get_match_data() return value as the
sensor name. The driver is in direct control of the string so I don't think
you need error handling here.
--
Sakari Ailus
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model
@ 2022-08-01 12:16 ` Sakari Ailus
0 siblings, 0 replies; 7+ messages in thread
From: Sakari Ailus @ 2022-08-01 12:16 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 6629 bytes --]
Hi Alexander,
On Fri, Jul 29, 2022 at 10:23:48AM +0200, Alexander Stein wrote:
> Am Donnerstag, 28. Juli 2022, 23:10:07 CEST schrieb kernel test robot:
> > Hi Alexander,
> >
> > Thank you for the patch! Perhaps something to improve:
> >
> > [auto build test WARNING on media-tree/master]
> > [also build test WARNING on linus/master v5.19-rc8 next-20220728]
> > [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/Alexander-Stein/OV9281-suppo
> > rt/20220728-210448 base: git://linuxtv.org/media_tree.git master
> > config: arm-randconfig-r022-20220728
> > (https://download.01.org/0day-ci/archive/20220729/202207290518.1D7MVS65-lkp
> > @intel.com/config) compiler: clang version 15.0.0
> > (https://github.com/llvm/llvm-project
> > 8dfaecc4c24494337933aff9d9166486ca0949f1) 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 arm cross compiling tool for clang build
> > # apt-get install binutils-arm-linux-gnueabi
> > #
> > https://github.com/intel-lab-lkp/linux/commit/ee28006553d4d23f600b0076ef606
> > 6710519f156 git remote add linux-review
> > https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review
> > Alexander-Stein/OV9281-support/20220728-210448 git checkout
> > ee28006553d4d23f600b0076ef6066710519f156
> > # save the config file
> > mkdir build_dir && cp config build_dir/.config
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1
> > O=build_dir ARCH=arm SHELL=/bin/bash drivers/media/i2c/
> >
> > If you fix the issue, kindly add following tag where applicable
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> > >> drivers/media/i2c/ov9282.c:1054:10: warning: variable 'ret' is
> > >> uninitialized when used here [-Wuninitialized]
> > return ret;
> > ^~~
> > drivers/media/i2c/ov9282.c:1041:9: note: initialize the variable 'ret' to
> > silence this warning int ret;
> > ^
> > = 0
> > 1 warning generated.
> >
> >
> > vim +/ret +1054 drivers/media/i2c/ov9282.c
> >
> > 1030
> > 1031 /**
> > 1032 * ov9282_probe() - I2C client device binding
> > 1033 * @client: pointer to i2c client device
> > 1034 *
> > 1035 * Return: 0 if successful, error code otherwise.
> > 1036 */
> > 1037 static int ov9282_probe(struct i2c_client *client)
> > 1038 {
> > 1039 struct ov9282 *ov9282;
> > 1040 const char *sensor_name;
> > 1041 int ret;
> > 1042
> > 1043 ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282),
> GFP_KERNEL);
> > 1044 if (!ov9282)
> > 1045 return -ENOMEM;
> > 1046
> > 1047 ov9282->dev = &client->dev;
> > 1048
> > 1049 /* Initialize subdev */
> > 1050 v4l2_i2c_subdev_init(&ov9282->sd, client,
> &ov9282_subdev_ops);
> > 1051 sensor_name = device_get_match_data(ov9282->dev);
> > 1052 if (!sensor_name) {
> > 1053 dev_err(ov9282->dev, "Sensor name is
> missing");
> >
> > > 1054 return ret;
> >
> > 1055 }
> > 1056 v4l2_i2c_subdev_set_name(&ov9282->sd, client,
> sensor_name, NULL);
> > 1057
> > 1058 ret = ov9282_parse_hw_config(ov9282);
> > 1059 if (ret) {
> > 1060 dev_err(ov9282->dev, "HW configuration is not
> supported");
> > 1061 return ret;
> > 1062 }
> > 1063
> > 1064 ret = ov9282_get_regulators(ov9282);
> > 1065 if (ret) {
> > 1066 dev_err(&client->dev, "Failed to get power
> regulators\n");
> > 1067 return ret;
> > 1068 }
> > 1069
> > 1070 mutex_init(&ov9282->mutex);
> > 1071
> > 1072 ret = ov9282_power_on(ov9282->dev);
> > 1073 if (ret) {
> > 1074 dev_err(ov9282->dev, "failed to power-on the
> sensor");
> > 1075 goto error_mutex_destroy;
> > 1076 }
> > 1077
> > 1078 /* Check module identity */
> > 1079 ret = ov9282_detect(ov9282);
> > 1080 if (ret) {
> > 1081 dev_err(ov9282->dev, "failed to find sensor:
> %d", ret);
> > 1082 goto error_power_off;
> > 1083 }
> > 1084
> > 1085 /* Set default mode to max resolution */
> > 1086 ov9282->cur_mode = &supported_mode;
> > 1087 ov9282->vblank = ov9282->cur_mode->vblank;
> > 1088
> > 1089 ret = ov9282_init_controls(ov9282);
> > 1090 if (ret) {
> > 1091 dev_err(ov9282->dev, "failed to init
> controls: %d", ret);
> > 1092 goto error_power_off;
> > 1093 }
> > 1094
> > 1095 /* Initialize subdev */
> > 1096 ov9282->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> > 1097 ov9282->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
> > 1098
> > 1099 /* Initialize source pad */
> > 1100 ov9282->pad.flags = MEDIA_PAD_FL_SOURCE;
> > 1101 ret = media_entity_pads_init(&ov9282->sd.entity, 1,
> &ov9282->pad);
> > 1102 if (ret) {
> > 1103 dev_err(ov9282->dev, "failed to init entity
> pads: %d", ret);
> > 1104 goto error_handler_free;
> > 1105 }
> > 1106
> > 1107 ret = v4l2_async_register_subdev_sensor(&ov9282->sd);
> > 1108 if (ret < 0) {
> > 1109 dev_err(ov9282->dev,
> > 1110 "failed to register async subdev:
> %d", ret);
> > 1111 goto error_media_entity;
> > 1112 }
> > 1113
> > 1114 pm_runtime_set_active(ov9282->dev);
> > 1115 pm_runtime_enable(ov9282->dev);
> > 1116 pm_runtime_idle(ov9282->dev);
> > 1117
> > 1118 return 0;
> > 1119
> > 1120 error_media_entity:
> > 1121 media_entity_cleanup(&ov9282->sd.entity);
> > 1122 error_handler_free:
> > 1123 v4l2_ctrl_handler_free(ov9282->sd.ctrl_handler);
> > 1124 error_power_off:
> > 1125 ov9282_power_off(ov9282->dev);
> > 1126 error_mutex_destroy:
> > 1127 mutex_destroy(&ov9282->mutex);
> > 1128
> > 1129 return ret;
> > 1130 }
> > 1131
>
> Meh, I'll come up with a fixed once discussion about the additional compatible
> has settled. This will also include the missing member documentation in patch
> 5
I think you could simply pass device_get_match_data() return value as the
sensor name. The driver is in direct control of the string so I don't think
you need error handling here.
--
Sakari Ailus
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-08-02 23:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-02 23:12 [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-07-28 13:02 [PATCH v4 0/7] OV9281 support Alexander Stein
2022-07-28 13:02 ` [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model Alexander Stein
2022-07-28 21:10 ` kernel test robot
2022-07-29 8:23 ` Alexander Stein
2022-07-29 8:23 ` Alexander Stein
2022-08-01 12:16 ` Sakari Ailus
2022-08-01 12:16 ` Sakari Ailus
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.