if (ret)
pdata->power_down_disable = 0;
pr_info("dis power down = %d;\n", pdata->power_down_disable);
- } else {
+ } else if (pdev) {
pdata = (struct bt_dev_data *)(pdev->dev.platform_data);
+ } else {
+ ret = -ENOENT;
+ goto err_res;
}
#else
pdata = (struct bt_dev_data *)(pdev->dev.platform_data);
rfkill_destroy(bt_rfk);
err_rfk_alloc:
bt_device_deinit(pdata);
+err_res:
return ret;
}
}
match = of_match_device(aml_dma_dt_match, &pdev->dev);
+ if (!match)
+ goto dma_err;
priv_data = match->data;
dma_dd->thread = priv_data->thread;
dma_dd->status = priv_data->status;
#include <linux/io.h>
#include <linux/slab.h>
+#undef pr_fmt
+#define pr_fmt(fmt) "ddr_tool: " fmt
+
static void gxl_dmc_port_config(struct ddr_bandwidth *db, int channel, int port)
{
unsigned int val;
subport = port - PORT_MAJOR;
val = readl(db->ddr_reg + port_reg[channel]);
- if (subport < 0) {
+ if (port < 16) {
val &= ~(0xffff << 16);
val |= ((1 << (16 + port)) | 0xffff);
- } else {
+ } else if (subport > 0) {
val &= ~(0xffffffff);
val |= (1 << 23) | (1 << subport);
+ } else {
+ pr_err("port config fail, %s: %d\n", __func__, __LINE__);
+ return;
}
writel(val, db->ddr_reg + port_reg[channel]);
}
class_destroy(&aml_ddr_class);
free_irq(aml_db->irq_num, aml_db);
kfree(aml_db->port_desc);
- kfree(aml_db);
iounmap(aml_db->ddr_reg);
iounmap(aml_db->pll_reg);
+ kfree(aml_db);
aml_db = NULL;
}
char *propname;
const char *uname;
int ret;
+ int size;
phandle = of_get_property(np, "key", NULL);
if (!phandle) {
pr_err("please config keyname item\n");
goto err;
}
+ size = sizeof(efusekey_infos[index].keyname) - 1;
strncpy(efusekey_infos[index].keyname, uname,
- strlen(uname) > sizeof(efusekey_infos[index].keyname) ?
- sizeof(efusekey_infos[index].keyname):strlen(uname));
+ strlen(uname) > size ? size:strlen(uname));
ret = of_property_read_u32(np_key, "offset",
&(efusekey_infos[index].offset));
if (ret) {
for (i = 0; i < COMMON_CALLER_SIZE; i++) {
s = &common_func[i];
if (!s->name)
- break; /* end */
+ break; /* end */
if (s->full_match) {
addr = kallsyms_contain_name(s->name, 1, NULL);
if (addr)
}
trace.ret_ip = (ip - text) >> 2;
- WARN_ON(trace.ret_ip > IP_RANGE_MASK);
#ifdef CONFIG_AMLOGIC_CMA
if (flag == __GFP_BDEV)
trace.migrate_type = MIGRATE_CMA;
retval = (ssize_t)len;
/* write down! */
if (storagekey_info.buffer != NULL) {
- buf = kzalloc(storagekey_info.size, GFP_KERNEL);
+ buf = kmalloc(storagekey_info.size, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
memcpy(buf, storagekey_info.buffer,
storagekey_info.size);
if (store_key_write)
static int key_efuse_init(struct key_info_t *uk_info,
char *buf, unsigned int len)
{
- unifykey_get_efuse_version(uk_info);
+ char var = 0;
+
+ var = unifykey_get_efuse_version(uk_info);
return 0;
}
char *keyname;
int ret;
-
key_item_info = kmalloc(sizeof(struct key_item_info_t),
GFP_KERNEL);
if (!key_item_info)
kfree(key_item_info);
return ret;
}
+ key_item_info->name[KEY_UNIFY_NAME_LEN - 1] = '\0';
index = key_item_info->id;
keyname = key_item_info->name;
if (strlen(keyname) > KEY_UNIFY_NAME_LEN - 1) {
key_item_info->flag = keystate;
key_item_info->id = kkey->id;
strncpy(key_item_info->name,
- kkey->name, KEY_UNIFY_NAME_LEN);
+ kkey->name, (KEY_UNIFY_NAME_LEN - 1));
+ key_item_info->name[KEY_UNIFY_NAME_LEN - 1] = '\0';
ret = key_unify_size(ukdev, kkey->name, &reallen);
if (ret < 0) {
pr_err("%s() %d, get size fail\n",
const struct of_device_id *match;
match = of_match_node(wifi_match, pdev->dev.of_node);
+ if (!match)
+ return NULL;
return (struct wifi_plat_info *)match->data;
}
#else
WIFI_INFO("ioctl Set sdio wifi power down!\n");
break;
case SDIO_GET_DEV_TYPE:
- memcpy(dev_type, get_wifi_inf(), strlen(get_wifi_inf()));
+ if (strlen(get_wifi_inf()) >= sizeof(dev_type))
+ memcpy(dev_type, get_wifi_inf(),
+ (sizeof(dev_type) - 1));
+ else
+ memcpy(dev_type, get_wifi_inf(),
+ strlen(get_wifi_inf()));
WIFI_INFO("wifi interface dev type: %s, length = %d\n",
dev_type, (int)strlen(dev_type));
if (copy_to_user((char __user *)arg,