Re: [PATCHv3 3/3] misc: add support for bmp18x chips to the bmp085driver

From: Mark Brown
Date: Wed Apr 04 2012 - 15:55:33 EST


On Wed, Apr 04, 2012 at 09:45:59PM +0200, Eric Andersson wrote:

> +static int __devinit bmp085_i2c_probe(struct i2c_client *client,
> + const struct i2c_device_id *id)
> +{
> + struct regmap *regmap = regmap_init_i2c(client, &bmp085_regmap_config);
> +
> + if (!regmap) {

Should be IS_ERR() - regmap uses PTR_ERR() and for error return values.
I'd also consider devm_regmap_init_i2c() (introduced in the merge
window) which saves you bothering to free it later on...

> + dev_err(&client->dev, "Failed to init regmap!\n");
> + return -ENOMEM;
> + }
> +
> + return bmp085_probe(&client->dev, regmap);

...right now it gets leaked so this would also fix an error.

> +static const struct of_device_id bmp085_of_match[] = {
> + { .compatible = "bosch-sensortec,bmp085", },

Traditionally the stock ticker symbol would be used.

> + status = regmap_bulk_read(data->regmap, BMP085_CONVERSION_REGISTER_MSB,
> + (u8 *)&tmp, sizeof(tmp));

Should be no need for the cast, the destination array argument is a
pointer to void.

Attachment: signature.asc
Description: Digital signature