Skip to contentSkip to conversation

iio: pressure: bmp280: fix error message for wrong chip id

PATCH Applied Akinobu Mita 2 participants 2 messages Apr 28, 2016 – May 14, 2016 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: pressure: bmp280: fix error message for wrong chip id

The bmp280 driver also supports BMP180 which has a different chip id with BMP280. The probe routine verifies that the device reports the correct chip id but the error message is confusing as if BMP280's chip id is always expected.

Cc Matt Ranostay <[email protected]>
Cc Vlad Dogaru <[email protected]>
Cc Christoph Mair <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Hartmut Knaack <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Peter Meerwald <[email protected]>
---
 drivers/iio/pressure/bmp280.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/pressure/bmp280.c +2 -2
index 2f1498e..724452d 100644
@@ -879,8 +879,8 @@ static int bmp280_probe(struct i2c_client *client,
 	if (ret < 0)
 		return ret;
 	if (chip_id != id->driver_data) {
-		dev_err(&client->dev, "bad chip id.  expected %x got %x\n",
-			BMP280_CHIP_ID, chip_id);
+		dev_err(&client->dev, "bad chip id.  expected %lx got %x\n",
+			id->driver_data, chip_id);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.5.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Akinobu Mita

The bmp280 driver also supports BMP180 which has a different chip id with BMP280. The probe routine verifies that the device reports the correct chip id but the error message is confusing as if BMP280's chip id is always expected.

Quoted 9 lines
Cc Matt Ranostay <[email protected]>
Cc Vlad Dogaru <[email protected]>
Cc Christoph Mair <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Hartmut Knaack <[email protected]>
Cc Lars-Peter Clausen <[email protected]>
Cc Peter Meerwald <[email protected]>

Applied to the fixes-togreg-post-rc1 branch of iio.git Clue to what happens next with this is in the branch name ;)

Thanks,

Jonathan

Quoted 20 lines
---
 drivers/iio/pressure/bmp280.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/pressure/bmp280.c +2 -2
index 2f1498e..724452d 100644
@@ -879,8 +879,8 @@ static int bmp280_probe(struct i2c_client *client,
 	if (ret < 0)
 		return ret;
 	if (chip_id != id->driver_data) {
-		dev_err(&client->dev, "bad chip id.  expected %x got %x\n",
-			BMP280_CHIP_ID, chip_id);
+		dev_err(&client->dev, "bad chip id.  expected %lx got %x\n",
+			id->driver_data, chip_id);
 		return -EINVAL;
 	}