diff options
author | Lee Jones <lee.jones@linaro.org> | 2015-10-28 09:57:44 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2016-01-14 03:43:59 -0500 |
commit | ae487ae2ac56ebe02e12fed38047ed41e682ad9e (patch) | |
tree | ff7ca19d1847715d02c53e60fbd1f50e819385cd | |
parent | 9f6e872a7003ea6b7f38bcfd5ee6c1e05b18672b (diff) |
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: Lee Jones <lee.jones@linaro.org>
-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 d001f7e238f5..94d67a6e1eb7 100644 --- a/drivers/mfd/as3711.c +++ b/drivers/mfd/as3711.c | |||
@@ -136,17 +136,13 @@ static int as3711_i2c_probe(struct i2c_client *client, | |||
136 | } else { | 136 | } else { |
137 | pdata = devm_kzalloc(&client->dev, | 137 | pdata = devm_kzalloc(&client->dev, |
138 | sizeof(*pdata), GFP_KERNEL); | 138 | sizeof(*pdata), GFP_KERNEL); |
139 | if (!pdata) { | 139 | if (!pdata) |
140 | dev_err(&client->dev, "Failed to allocate pdata\n"); | ||
141 | return -ENOMEM; | 140 | return -ENOMEM; |
142 | } | ||
143 | } | 141 | } |
144 | 142 | ||
145 | as3711 = devm_kzalloc(&client->dev, sizeof(struct as3711), GFP_KERNEL); | 143 | as3711 = devm_kzalloc(&client->dev, sizeof(struct as3711), GFP_KERNEL); |
146 | if (!as3711) { | 144 | if (!as3711) |
147 | dev_err(&client->dev, "Memory allocation failed\n"); | ||
148 | return -ENOMEM; | 145 | return -ENOMEM; |
149 | } | ||
150 | 146 | ||
151 | as3711->dev = &client->dev; | 147 | as3711->dev = &client->dev; |
152 | i2c_set_clientdata(client, as3711); | 148 | i2c_set_clientdata(client, as3711); |
@@ -157,7 +153,8 @@ static int as3711_i2c_probe(struct i2c_client *client, | |||
157 | as3711->regmap = devm_regmap_init_i2c(client, &as3711_regmap_config); | 153 | as3711->regmap = devm_regmap_init_i2c(client, &as3711_regmap_config); |
158 | if (IS_ERR(as3711->regmap)) { | 154 | if (IS_ERR(as3711->regmap)) { |
159 | ret = PTR_ERR(as3711->regmap); | 155 | ret = PTR_ERR(as3711->regmap); |
160 | dev_err(&client->dev, "regmap initialization failed: %d\n", ret); | 156 | dev_err(&client->dev, |
157 | "regmap initialization failed: %d\n", ret); | ||
161 | return ret; | 158 | return ret; |
162 | } | 159 | } |
163 | 160 | ||
@@ -172,12 +169,19 @@ static int as3711_i2c_probe(struct i2c_client *client, | |||
172 | return -ENODEV; | 169 | return -ENODEV; |
173 | dev_info(as3711->dev, "AS3711 detected: %x:%x\n", id1, id2); | 170 | dev_info(as3711->dev, "AS3711 detected: %x:%x\n", id1, id2); |
174 | 171 | ||
175 | /* We can reuse as3711_subdevs[], it will be copied in mfd_add_devices() */ | 172 | /* |
173 | * We can reuse as3711_subdevs[], | ||
174 | * it will be copied in mfd_add_devices() | ||
175 | */ | ||
176 | if (pdata) { | 176 | if (pdata) { |
177 | as3711_subdevs[AS3711_REGULATOR].platform_data = &pdata->regulator; | 177 | as3711_subdevs[AS3711_REGULATOR].platform_data = |
178 | as3711_subdevs[AS3711_REGULATOR].pdata_size = sizeof(pdata->regulator); | 178 | &pdata->regulator; |
179 | as3711_subdevs[AS3711_BACKLIGHT].platform_data = &pdata->backlight; | 179 | as3711_subdevs[AS3711_REGULATOR].pdata_size = |
180 | as3711_subdevs[AS3711_BACKLIGHT].pdata_size = sizeof(pdata->backlight); | 180 | sizeof(pdata->regulator); |
181 | as3711_subdevs[AS3711_BACKLIGHT].platform_data = | ||
182 | &pdata->backlight; | ||
183 | as3711_subdevs[AS3711_BACKLIGHT].pdata_size = | ||
184 | sizeof(pdata->backlight); | ||
181 | } else { | 185 | } else { |
182 | as3711_subdevs[AS3711_REGULATOR].platform_data = NULL; | 186 | as3711_subdevs[AS3711_REGULATOR].platform_data = NULL; |
183 | as3711_subdevs[AS3711_REGULATOR].pdata_size = 0; | 187 | as3711_subdevs[AS3711_REGULATOR].pdata_size = 0; |