Commit ae487ae2 authored by Lee Jones's avatar Lee Jones

mfd: as3711: Repair OOM and 'line over 80 chars' formatting warnings

WARNING: Possible unnecessary 'out of memory' message
+               if (!pdata) {
+                       dev_err(&client->dev, "Failed to allocate pdata\n");

WARNING: Possible unnecessary 'out of memory' message
+       if (!as3711) {
+               dev_err(&client->dev, "Memory allocation failed\n");

WARNING: line over 80 characters
+               dev_err(&client->dev, "regmap initialization failed: %d\n", ret);

WARNING: line over 80 characters
+       /* We can reuse as3711_subdevs[], it will be copied in mfd_add_devices() */

WARNING: line over 80 characters
+               as3711_subdevs[AS3711_REGULATOR].platform_data = &pdata->regulator;

WARNING: line over 80 characters
+               as3711_subdevs[AS3711_REGULATOR].pdata_size = sizeof(pdata->regulator);

WARNING: line over 80 characters
+               as3711_subdevs[AS3711_BACKLIGHT].platform_data = &pdata->backlight;

WARNING: line over 80 characters
+               as3711_subdevs[AS3711_BACKLIGHT].pdata_size = sizeof(pdata->backlight);

total: 0 errors, 8 warnings, 236 lines checked
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 9f6e872a
...@@ -136,17 +136,13 @@ static int as3711_i2c_probe(struct i2c_client *client, ...@@ -136,17 +136,13 @@ static int as3711_i2c_probe(struct i2c_client *client,
} else { } else {
pdata = devm_kzalloc(&client->dev, pdata = devm_kzalloc(&client->dev,
sizeof(*pdata), GFP_KERNEL); sizeof(*pdata), GFP_KERNEL);
if (!pdata) { if (!pdata)
dev_err(&client->dev, "Failed to allocate pdata\n");
return -ENOMEM; return -ENOMEM;
} }
}
as3711 = devm_kzalloc(&client->dev, sizeof(struct as3711), GFP_KERNEL); as3711 = devm_kzalloc(&client->dev, sizeof(struct as3711), GFP_KERNEL);
if (!as3711) { if (!as3711)
dev_err(&client->dev, "Memory allocation failed\n");
return -ENOMEM; return -ENOMEM;
}
as3711->dev = &client->dev; as3711->dev = &client->dev;
i2c_set_clientdata(client, as3711); i2c_set_clientdata(client, as3711);
...@@ -157,7 +153,8 @@ static int as3711_i2c_probe(struct i2c_client *client, ...@@ -157,7 +153,8 @@ static int as3711_i2c_probe(struct i2c_client *client,
as3711->regmap = devm_regmap_init_i2c(client, &as3711_regmap_config); as3711->regmap = devm_regmap_init_i2c(client, &as3711_regmap_config);
if (IS_ERR(as3711->regmap)) { if (IS_ERR(as3711->regmap)) {
ret = PTR_ERR(as3711->regmap); ret = PTR_ERR(as3711->regmap);
dev_err(&client->dev, "regmap initialization failed: %d\n", ret); dev_err(&client->dev,
"regmap initialization failed: %d\n", ret);
return ret; return ret;
} }
...@@ -172,12 +169,19 @@ static int as3711_i2c_probe(struct i2c_client *client, ...@@ -172,12 +169,19 @@ static int as3711_i2c_probe(struct i2c_client *client,
return -ENODEV; return -ENODEV;
dev_info(as3711->dev, "AS3711 detected: %x:%x\n", id1, id2); dev_info(as3711->dev, "AS3711 detected: %x:%x\n", id1, id2);
/* We can reuse as3711_subdevs[], it will be copied in mfd_add_devices() */ /*
* We can reuse as3711_subdevs[],
* it will be copied in mfd_add_devices()
*/
if (pdata) { if (pdata) {
as3711_subdevs[AS3711_REGULATOR].platform_data = &pdata->regulator; as3711_subdevs[AS3711_REGULATOR].platform_data =
as3711_subdevs[AS3711_REGULATOR].pdata_size = sizeof(pdata->regulator); &pdata->regulator;
as3711_subdevs[AS3711_BACKLIGHT].platform_data = &pdata->backlight; as3711_subdevs[AS3711_REGULATOR].pdata_size =
as3711_subdevs[AS3711_BACKLIGHT].pdata_size = sizeof(pdata->backlight); sizeof(pdata->regulator);
as3711_subdevs[AS3711_BACKLIGHT].platform_data =
&pdata->backlight;
as3711_subdevs[AS3711_BACKLIGHT].pdata_size =
sizeof(pdata->backlight);
} else { } else {
as3711_subdevs[AS3711_REGULATOR].platform_data = NULL; as3711_subdevs[AS3711_REGULATOR].platform_data = NULL;
as3711_subdevs[AS3711_REGULATOR].pdata_size = 0; as3711_subdevs[AS3711_REGULATOR].pdata_size = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment