Hello,

It looks like an unlock is missing before line 110.

julia

---------- Forwarded message ----------
Date: Mon, 4 Mar 2019 03:30:02 +0800
From: kbuild test robot <l...@intel.com>
To: kbu...@01.org
Cc: Julia Lawall <julia.law...@lip6.fr>
Subject: Re: [PATCH v2 3/4] mb12x2.c: add distance iio sensor with i2c

Hi Andreas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iio/togreg]
[also build test WARNING on v5.0-rc8 next-20190301]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Andreas-Klinger/add-MaxBotix-I2CXL-ultrasonic-iio-driver/20190304-001520
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago

>> drivers/iio/proximity/mb12x2.c:110:2-8: preceding lock on line 70

# 
https://github.com/0day-ci/linux/commit/a931c13b9c38d77e8dbf0b8aa64288a4bfcc789c
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout a931c13b9c38d77e8dbf0b8aa64288a4bfcc789c
vim +110 drivers/iio/proximity/mb12x2.c

a931c13b Andreas Klinger 2019-03-01   62
a931c13b Andreas Klinger 2019-03-01   63  static s16 
mb12x2_read_distance(struct mb12x2_data *data)
a931c13b Andreas Klinger 2019-03-01   64  {
a931c13b Andreas Klinger 2019-03-01   65        struct i2c_client *client = 
data->client;
a931c13b Andreas Klinger 2019-03-01   66        int ret;
a931c13b Andreas Klinger 2019-03-01   67        s16 distance;
a931c13b Andreas Klinger 2019-03-01   68        __be16 buf;
a931c13b Andreas Klinger 2019-03-01   69
a931c13b Andreas Klinger 2019-03-01  @70        mutex_lock(&data->lock);
a931c13b Andreas Klinger 2019-03-01   71
a931c13b Andreas Klinger 2019-03-01   72        
reinit_completion(&data->ranging);
a931c13b Andreas Klinger 2019-03-01   73
a931c13b Andreas Klinger 2019-03-01   74        ret = 
i2c_smbus_write_byte(client, MB12X2_RANGE_COMMAND);
a931c13b Andreas Klinger 2019-03-01   75        if (ret < 0) {
a931c13b Andreas Klinger 2019-03-01   76                dev_err(&client->dev, 
"write command - err: %d\n", ret);
a931c13b Andreas Klinger 2019-03-01   77                
mutex_unlock(&data->lock);
a931c13b Andreas Klinger 2019-03-01   78                return ret;
a931c13b Andreas Klinger 2019-03-01   79        }
a931c13b Andreas Klinger 2019-03-01   80
a931c13b Andreas Klinger 2019-03-01   81        if (data->gpiod_status) {
a931c13b Andreas Klinger 2019-03-01   82                /* it cannot take more 
than 100 ms */
a931c13b Andreas Klinger 2019-03-01   83                ret = 
wait_for_completion_killable_timeout(&data->ranging,
a931c13b Andreas Klinger 2019-03-01   84                                        
                                HZ/10);
a931c13b Andreas Klinger 2019-03-01   85                if (ret < 0) {
a931c13b Andreas Klinger 2019-03-01   86                        
mutex_unlock(&data->lock);
a931c13b Andreas Klinger 2019-03-01   87                        return ret;
a931c13b Andreas Klinger 2019-03-01   88                } else if (ret == 0) {
a931c13b Andreas Klinger 2019-03-01   89                        
mutex_unlock(&data->lock);
a931c13b Andreas Klinger 2019-03-01   90                        return 
-ETIMEDOUT;
a931c13b Andreas Klinger 2019-03-01   91                }
a931c13b Andreas Klinger 2019-03-01   92        } else {
a931c13b Andreas Klinger 2019-03-01   93                /*
a931c13b Andreas Klinger 2019-03-01   94                 * use simple sleep if 
gpio announce pin is not connected
a931c13b Andreas Klinger 2019-03-01   95                 */
a931c13b Andreas Klinger 2019-03-01   96                msleep(15);
a931c13b Andreas Klinger 2019-03-01   97        }
a931c13b Andreas Klinger 2019-03-01   98
a931c13b Andreas Klinger 2019-03-01   99        ret = i2c_master_recv(client, 
(char *)&buf, sizeof(buf));
a931c13b Andreas Klinger 2019-03-01  100        if (ret < 0) {
a931c13b Andreas Klinger 2019-03-01  101                dev_err(&client->dev, 
"i2c_master_recv: ret=%d\n", ret);
a931c13b Andreas Klinger 2019-03-01  102                
mutex_unlock(&data->lock);
a931c13b Andreas Klinger 2019-03-01  103                return ret;
a931c13b Andreas Klinger 2019-03-01  104        }
a931c13b Andreas Klinger 2019-03-01  105
a931c13b Andreas Klinger 2019-03-01  106        distance = __be16_to_cpu(buf);
a931c13b Andreas Klinger 2019-03-01  107        /* check for not returning 
misleading error codes */
a931c13b Andreas Klinger 2019-03-01  108        if (distance < 0) {
a931c13b Andreas Klinger 2019-03-01  109                dev_err(&client->dev, 
"distance=%d\n", distance);
a931c13b Andreas Klinger 2019-03-01 @110                return -EINVAL;
a931c13b Andreas Klinger 2019-03-01  111        }
a931c13b Andreas Klinger 2019-03-01  112
a931c13b Andreas Klinger 2019-03-01  113        mutex_unlock(&data->lock);
a931c13b Andreas Klinger 2019-03-01  114
a931c13b Andreas Klinger 2019-03-01  115        return distance;
a931c13b Andreas Klinger 2019-03-01  116  }
a931c13b Andreas Klinger 2019-03-01  117

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Reply via email to