public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Andreas Klinger <ak@it-klinger.de>
Cc: devicetree@vger.kernel.org, linux-iio@vger.kernel.org,
	kbuild-all@01.org, jic23@kernel.org, robh+dt@kernel.org,
	mark.rutland@arm.com, afaerber@suse.de, arnd@arndb.de,
	davem@davemloft.net, gregkh@linuxfoundation.org,
	johan@kernel.org, khilman@baylibre.com, knaack.h@gmx.de,
	lars@metafoo.de, linux-kernel@vger.kernel.org,
	martin.blumenstingl@googlemail.com, mchehab+samsung@kernel.org,
	m.othacehe@gmail.com, nicolas.ferre@microchip.com,
	pmeerw@pmeerw.net, robh@kernel.org, songqiang1304521@gmail.com,
	treding@nvidia.com, techsupport@maxbotix.com
Subject: Re: [PATCH v2 3/4] mb12x2.c: add distance iio sensor with i2c (fwd)
Date: Sun, 3 Mar 2019 20:33:43 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.1903032032330.2540@hadrien> (raw)

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 <lkp@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@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	other threads:[~2019-03-03 19:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=alpine.DEB.2.21.1903032032330.2540@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=afaerber@suse.de \
    --cc=ak@it-klinger.de \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=johan@kernel.org \
    --cc=kbuild-all@01.org \
    --cc=khilman@baylibre.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.othacehe@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=mchehab+samsung@kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=songqiang1304521@gmail.com \
    --cc=techsupport@maxbotix.com \
    --cc=treding@nvidia.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