@@ -116,19 +116,12 @@ static void __init sr_set_nvalues(struct omap_sr_dev_data *dev_data,
static int sr_dev_init(struct omap_hwmod *oh, void *user)
{
- struct omap_sr_data *sr_data;
+ struct omap_sr_data sr_data = {0};
struct omap_sr_dev_data *sr_dev_data;
struct omap_device *od;
char *name = "smartreflex";
static int i;
- sr_data = kzalloc(sizeof(struct omap_sr_data), GFP_KERNEL);
- if (!sr_data) {
- pr_err("%s: Unable to allocate memory for %s sr_data.Error!\n",
- __func__, oh->name);
- return -ENOMEM;
- }
-
sr_dev_data = (struct omap_sr_dev_data *)oh->dev_attr;
/*
* OMAP3430 ES3.1 chips by default come with Efuse burnt
@@ -139,32 +132,30 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
*/
if (cpu_is_omap343x()) {
if (omap_rev() == OMAP3430_REV_ES3_1)
- sr_data->enable_on_init = true;
+ sr_data.enable_on_init = true;
else
- sr_data->enable_on_init = false;
+ sr_data.enable_on_init = false;
} else {
- sr_data->enable_on_init = false;
+ sr_data.enable_on_init = false;
}
- sr_data->device_enable = omap_device_enable;
- sr_data->device_shutdown = omap_device_shutdown;
- sr_data->device_idle = omap_device_idle;
+ sr_data.device_enable = omap_device_enable;
+ sr_data.device_shutdown = omap_device_shutdown;
+ sr_data.device_idle = omap_device_idle;
sr_dev_data->volts_supported = omap_get_voltage_table(i,
&sr_dev_data->volt_data);
if (!sr_dev_data->volts_supported) {
pr_warning("%s: No Voltage table registerd fo VDD%d.Something \
really wrong\n\n", __func__, i + 1);
i++;
- kfree(sr_data);
return 0;
}
- sr_set_nvalues(sr_dev_data, sr_data);
- od = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
+ sr_set_nvalues(sr_dev_data, &sr_data);
+ od = omap_device_build(name, i, oh, &sr_data, sizeof(sr_data),
omap_sr_latency,
ARRAY_SIZE(omap_sr_latency), 0);
if (IS_ERR(od)) {
pr_warning("%s: Could not build omap_device for %s: %s.\n\n",
__func__, name, oh->name);
- kfree(sr_data);
}
i++;
return 0;