From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Jagath Jog J <jagathjog1996@gmail.com>,
dan@dlrobertson.com, jic23@kernel.org, andy.shevchenko@gmail.com
Cc: lkp@intel.com, kbuild-all@lists.01.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 9/9] iio: accel: bma400: Add support for activity and inactivity events
Date: Tue, 12 Apr 2022 10:38:11 +0300 [thread overview]
Message-ID: <202204121411.snZVqiMy-lkp@intel.com> (raw)
In-Reply-To: <20220411203133.19929-10-jagathjog1996@gmail.com>
Hi Jagath,
url: https://github.com/intel-lab-lkp/linux/commits/Jagath-Jog-J/iio-accel-bma400-Add-buffer-step-and-activity-inactivity/20220412-043436
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: x86_64-randconfig-m001-20220411 (https://download.01.org/0day-ci/archive/20220412/202204121411.snZVqiMy-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/iio/accel/bma400_core.c:1154 bma400_read_event_value() warn: impossible condition '(reg < 0) => (0-255 < 0)'
drivers/iio/accel/bma400_core.c:1202 bma400_write_event_value() warn: impossible condition '(reg < 0) => (0-255 < 0)'
vim +1154 drivers/iio/accel/bma400_core.c
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1142 static int bma400_read_event_value(struct iio_dev *indio_dev,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1143 const struct iio_chan_spec *chan,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1144 enum iio_event_type type,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1145 enum iio_event_direction dir,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1146 enum iio_event_info info,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1147 int *val, int *val2)
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1148 {
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1149 struct bma400_data *data = iio_priv(indio_dev);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1150 int ret;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1151 u8 reg, duration[2];
^^^^^^
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1152
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1153 reg = get_gen_config_reg(dir);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 @1154 if (reg < 0)
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1155 return -EINVAL;
Condition is impossible. Also propagate the return? if (ret < 0) return ret;?
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1156
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1157 *val2 = 0;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1158 switch (info) {
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1159 case IIO_EV_INFO_VALUE:
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1160 mutex_lock(&data->mutex);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1161 ret = regmap_read(data->regmap, reg + BMA400_GEN_CONFIG2_OFF,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1162 val);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1163 mutex_unlock(&data->mutex);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1164 if (ret)
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1165 return ret;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1166 return IIO_VAL_INT;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1167 case IIO_EV_INFO_PERIOD:
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1168 mutex_lock(&data->mutex);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1169 ret = regmap_bulk_read(data->regmap,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1170 reg + BMA400_GEN_CONFIG3_OFF,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1171 duration, sizeof(duration));
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1172 mutex_unlock(&data->mutex);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1173 if (ret)
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1174 return ret;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1175 *val = get_unaligned_be16(duration);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1176 return IIO_VAL_INT;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1177 case IIO_EV_INFO_HYSTERESIS:
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1178 mutex_lock(&data->mutex);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1179 ret = regmap_read(data->regmap, reg, val);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1180 mutex_unlock(&data->mutex);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1181 if (ret)
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1182 return ret;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1183 *val = FIELD_GET(BMA400_GEN_HYST_MSK, *val);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1184 return IIO_VAL_INT;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1185 default:
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1186 return -EINVAL;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1187 }
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1188 }
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1189
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1190 static int bma400_write_event_value(struct iio_dev *indio_dev,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1191 const struct iio_chan_spec *chan,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1192 enum iio_event_type type,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1193 enum iio_event_direction dir,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1194 enum iio_event_info info,
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1195 int val, int val2)
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1196 {
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1197 struct bma400_data *data = iio_priv(indio_dev);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1198 int ret;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1199 u8 reg, duration[2];
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1200
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1201 reg = get_gen_config_reg(dir);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 @1202 if (reg < 0)
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1203 return -EINVAL;
Same.
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1204
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1205 switch (info) {
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1206 case IIO_EV_INFO_VALUE:
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1207 if (val < 1 || val > 255)
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1208 return -EINVAL;
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1209
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1210 mutex_lock(&data->mutex);
15ee6de45ed7a02 Jagath Jog J 2022-04-12 1211 ret = regmap_write(data->regmap, reg + BMA400_GEN_CONFIG2_OFF,
--
0-DAY CI Kernel Test Service
https://01.org/lkp
next prev parent reply other threads:[~2022-04-12 10:04 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-11 20:31 [PATCH v3 0/9] iio: accel: bma400: Add buffer, step and activity/inactivity Jagath Jog J
2022-04-11 20:31 ` [PATCH v3 1/9] iio: accel: bma400: Fix the scale min and max macro values Jagath Jog J
2022-04-12 8:59 ` Andy Shevchenko
2022-04-11 20:31 ` [PATCH v3 2/9] iio: accel: bma400: Reordering of header files Jagath Jog J
2022-04-12 9:00 ` Andy Shevchenko
2022-04-11 20:31 ` [PATCH v3 3/9] iio: accel: bma400: conversion to device-managed function Jagath Jog J
2022-04-12 9:04 ` Andy Shevchenko
2022-04-11 20:31 ` [PATCH v3 4/9] iio: accel: bma400: Add triggered buffer support Jagath Jog J
2022-04-12 9:12 ` Andy Shevchenko
2022-04-12 19:30 ` Jagath Jog J
[not found] ` <CAHp75Vc9MO2GxX81JQfzGRjM=nWLaQ-Uy9bV-dR1GMj1oQwjSQ@mail.gmail.com>
[not found] ` <CAHp75Vef21YmiKAvz-Kt-C=jb+mMCJeV_fwPAza9UwCuKy6omQ@mail.gmail.com>
2022-04-13 14:23 ` Jagath Jog J
2022-04-14 13:22 ` Jagath Jog J
2022-04-16 16:38 ` Jonathan Cameron
2022-04-11 20:31 ` [PATCH v3 5/9] iio: accel: bma400: Add separate channel for step counter Jagath Jog J
2022-04-16 16:41 ` Jonathan Cameron
2022-04-11 20:31 ` [PATCH v3 6/9] iio: accel: bma400: Add step change event Jagath Jog J
2022-04-11 20:31 ` [PATCH v3 7/9] iio: accel: bma400: Add activity recognition support Jagath Jog J
2022-04-16 16:47 ` Jonathan Cameron
2022-04-11 20:31 ` [PATCH v3 8/9] iio: accel: bma400: Add debugfs register access support Jagath Jog J
2022-04-16 16:48 ` Jonathan Cameron
2022-04-11 20:31 ` [PATCH v3 9/9] iio: accel: bma400: Add support for activity and inactivity events Jagath Jog J
2022-04-12 5:21 ` kernel test robot
2022-04-12 7:38 ` Dan Carpenter [this message]
2022-04-12 10:41 ` kernel test robot
2022-04-16 16:55 ` Jonathan Cameron
2022-04-18 22:09 ` Jagath Jog J
2022-04-24 15:40 ` Jonathan Cameron
2022-04-25 12:03 ` jagath jogj
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=202204121411.snZVqiMy-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=andy.shevchenko@gmail.com \
--cc=dan@dlrobertson.com \
--cc=jagathjog1996@gmail.com \
--cc=jic23@kernel.org \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
/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