lkml.org 
[lkml]   [2012]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv3 3/3] misc: add support for bmp18x chips to the bmp085 driver
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.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-04-04 21:57    [W:0.056 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site