diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-03-25 03:53:42 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-03-25 03:53:42 -0300 |
commit | 03dd4cb26d967f9588437b0fc9cc0e8353322bb7 (patch) | |
tree | fa581f6dc1c0596391690d1f67eceef3af8246dc /drivers/mfd/as3711.c | |
parent | d4e493caf788ef44982e131ff9c786546904d934 (diff) |
Linux-libre 4.5-gnu
Diffstat (limited to 'drivers/mfd/as3711.c')
-rw-r--r-- | drivers/mfd/as3711.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/mfd/as3711.c b/drivers/mfd/as3711.c index d001f7e23..94d67a6e1 100644 --- a/drivers/mfd/as3711.c +++ b/drivers/mfd/as3711.c @@ -136,17 +136,13 @@ static int as3711_i2c_probe(struct i2c_client *client, } else { pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - dev_err(&client->dev, "Failed to allocate pdata\n"); + if (!pdata) return -ENOMEM; - } } as3711 = devm_kzalloc(&client->dev, sizeof(struct as3711), GFP_KERNEL); - if (!as3711) { - dev_err(&client->dev, "Memory allocation failed\n"); + if (!as3711) return -ENOMEM; - } as3711->dev = &client->dev; i2c_set_clientdata(client, as3711); @@ -157,7 +153,8 @@ static int as3711_i2c_probe(struct i2c_client *client, as3711->regmap = devm_regmap_init_i2c(client, &as3711_regmap_config); if (IS_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; } @@ -172,12 +169,19 @@ static int as3711_i2c_probe(struct i2c_client *client, return -ENODEV; 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) { - as3711_subdevs[AS3711_REGULATOR].platform_data = &pdata->regulator; - as3711_subdevs[AS3711_REGULATOR].pdata_size = sizeof(pdata->regulator); - as3711_subdevs[AS3711_BACKLIGHT].platform_data = &pdata->backlight; - as3711_subdevs[AS3711_BACKLIGHT].pdata_size = sizeof(pdata->backlight); + as3711_subdevs[AS3711_REGULATOR].platform_data = + &pdata->regulator; + as3711_subdevs[AS3711_REGULATOR].pdata_size = + sizeof(pdata->regulator); + as3711_subdevs[AS3711_BACKLIGHT].platform_data = + &pdata->backlight; + as3711_subdevs[AS3711_BACKLIGHT].pdata_size = + sizeof(pdata->backlight); } else { as3711_subdevs[AS3711_REGULATOR].platform_data = NULL; as3711_subdevs[AS3711_REGULATOR].pdata_size = 0; |