summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiran Gunda <kgunda@codeaurora.org>2017-05-03 11:35:28 +0530
committerKiran Gunda <kgunda@codeaurora.org>2017-05-03 15:06:51 +0530
commit08e56dd325923c76752d160a3ee2b938bad66e48 (patch)
treef7aaf4f0469c52c2ba20bee7d9a79ad3262552fc
parent660dbf1cf4d78f3c77dab65d0a62a58bd838fb3d (diff)
regulator: onsemi-ncp6335d: Fix compilation issues
Fix the compilation issue seen due to the regulator framework changes from 3.10 to 4.4 kernel. Also remove the redundant error messages during the memory allocation failures. Change-Id: I4887c2d3acaff562fb41e6c2eaeb2c1ef2c1bde5 Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
-rw-r--r--drivers/regulator/onsemi-ncp6335d.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/regulator/onsemi-ncp6335d.c b/drivers/regulator/onsemi-ncp6335d.c
index 056893fc5810..595fde1c825f 100644
--- a/drivers/regulator/onsemi-ncp6335d.c
+++ b/drivers/regulator/onsemi-ncp6335d.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2014, 2017 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -504,7 +504,7 @@ static struct ncp6335d_platform_data *
int rc;
init_data = of_get_regulator_init_data(&client->dev,
- client->dev.of_node);
+ client->dev.of_node, &rdesc);
if (!init_data) {
dev_err(&client->dev, "regulator init data is missing\n");
return pdata;
@@ -512,10 +512,8 @@ static struct ncp6335d_platform_data *
pdata = devm_kzalloc(&client->dev,
sizeof(struct ncp6335d_platform_data), GFP_KERNEL);
- if (!pdata) {
- dev_err(&client->dev, "ncp6335d_platform_data allocation failed.\n");
+ if (!pdata)
return pdata;
- }
rc = of_property_read_u32(client->dev.of_node,
"onnn,vsel", &pdata->default_vsel);
@@ -621,10 +619,8 @@ static int ncp6335d_regulator_probe(struct i2c_client *client,
}
dd = devm_kzalloc(&client->dev, sizeof(*dd), GFP_KERNEL);
- if (!dd) {
- dev_err(&client->dev, "Unable to allocate memory\n");
+ if (!dd)
return -ENOMEM;
- }
if (client->dev.of_node) {
rc = ncp6335d_parse_dt(client, dd);
@@ -657,7 +653,7 @@ static int ncp6335d_regulator_probe(struct i2c_client *client,
rc = ncp6335d_init(client, dd, pdata);
if (rc) {
- dev_err(&client->dev, "Unable to intialize the regulator\n");
+ dev_err(&client->dev, "Unable to initialize the regulator\n");
return -EINVAL;
}
@@ -712,7 +708,7 @@ static int ncp6335d_regulator_remove(struct i2c_client *client)
return 0;
}
-static struct of_device_id ncp6335d_match_table[] = {
+static const struct of_device_id ncp6335d_match_table[] = {
{ .compatible = "onnn,ncp6335d-regulator", },
{},
};
@@ -746,8 +742,8 @@ int __init ncp6335d_regulator_init(void)
if (initialized)
return 0;
- else
- initialized = true;
+
+ initialized = true;
return i2c_add_driver(&ncp6335d_regulator_driver);
}