aboutsummaryrefslogtreecommitdiffstats
path: root/net/rfkill
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2014-04-01 10:02:56 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-04-11 03:29:22 -0400
commit781d4e0fb73379e251d1ac1562fe9892da711760 (patch)
treefc6d0d0e32d5b18f271e98ea04fc1ba015faf289 /net/rfkill
parent41d09df1e08bf18316d08cb73c5d08b5346c0c5d (diff)
net: rfkill: gpio: hard-code the gpio names
There is no need to dynamically generate the names. This will fix a static checker warning.. net/rfkill/rfkill-gpio.c:144 rfkill_gpio_probe() warn: variable dereferenced before check 'rfkill->name' Acked-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/rfkill')
-rw-r--r--net/rfkill/rfkill-gpio.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 436bffb68868..9c4a5eb91cbf 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -36,8 +36,6 @@ struct rfkill_gpio_data {
36 struct gpio_desc *shutdown_gpio; 36 struct gpio_desc *shutdown_gpio;
37 37
38 struct rfkill *rfkill_dev; 38 struct rfkill *rfkill_dev;
39 char *reset_name;
40 char *shutdown_name;
41 struct clk *clk; 39 struct clk *clk;
42 40
43 bool clk_enabled; 41 bool clk_enabled;
@@ -89,7 +87,6 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
89 struct rfkill_gpio_data *rfkill; 87 struct rfkill_gpio_data *rfkill;
90 struct gpio_desc *gpio; 88 struct gpio_desc *gpio;
91 int ret; 89 int ret;
92 int len;
93 90
94 rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); 91 rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL);
95 if (!rfkill) 92 if (!rfkill)
@@ -106,21 +103,9 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
106 return -ENODEV; 103 return -ENODEV;
107 } 104 }
108 105
109 len = strlen(rfkill->name);
110 rfkill->reset_name = devm_kzalloc(&pdev->dev, len + 7, GFP_KERNEL);
111 if (!rfkill->reset_name)
112 return -ENOMEM;
113
114 rfkill->shutdown_name = devm_kzalloc(&pdev->dev, len + 10, GFP_KERNEL);
115 if (!rfkill->shutdown_name)
116 return -ENOMEM;
117
118 snprintf(rfkill->reset_name, len + 6 , "%s_reset", rfkill->name);
119 snprintf(rfkill->shutdown_name, len + 9, "%s_shutdown", rfkill->name);
120
121 rfkill->clk = devm_clk_get(&pdev->dev, NULL); 106 rfkill->clk = devm_clk_get(&pdev->dev, NULL);
122 107
123 gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0); 108 gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0);
124 if (!IS_ERR(gpio)) { 109 if (!IS_ERR(gpio)) {
125 ret = gpiod_direction_output(gpio, 0); 110 ret = gpiod_direction_output(gpio, 0);
126 if (ret) 111 if (ret)
@@ -128,7 +113,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
128 rfkill->reset_gpio = gpio; 113 rfkill->reset_gpio = gpio;
129 } 114 }
130 115
131 gpio = devm_gpiod_get_index(&pdev->dev, rfkill->shutdown_name, 1); 116 gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1);
132 if (!IS_ERR(gpio)) { 117 if (!IS_ERR(gpio)) {
133 ret = gpiod_direction_output(gpio, 0); 118 ret = gpiod_direction_output(gpio, 0);
134 if (ret) 119 if (ret)