defect: driver defect cleanup

PD#163273: driver defect cleanup

435
477
478
479
480
482
485
486
487
488
555
573
594
617
648
650
678
855

Change-Id: Ifb2d89576e4cbb77449732d79f688c970bb0dca1
Signed-off-by: Jiamin Ma <jiamin.ma@amlogic.com>
This commit is contained in:
Jiamin Ma
2018-03-29 18:56:01 +08:00
committed by Yixun Lan
parent ba3e7b9198
commit df1d0cddf7
6 changed files with 16 additions and 11 deletions

View File

@@ -318,7 +318,7 @@ ssize_t efuse_user_attr_store(char *name, const char *buf, size_t count)
local_buf = kzalloc(sizeof(char)*(count), GFP_KERNEL);
memcpy(local_buf, buf, strlen(buf));
memcpy(local_buf, buf, count);
c = ":";
s = local_buf;
@@ -569,7 +569,9 @@ int get_efusekey_info(struct device_node *np)
pr_err("please config keyname item\n");
goto err;
}
strcpy(efusekey_infos[index].keyname, uname);
strncpy(efusekey_infos[index].keyname, uname,
strlen(uname) > sizeof(efusekey_infos[index].keyname) ?
sizeof(efusekey_infos[index].keyname):strlen(uname));
ret = of_property_read_u32(np_key, "offset",
&(efusekey_infos[index].offset));
if (ret) {

View File

@@ -109,12 +109,10 @@ static irqreturn_t mbox_handler(int irq, void *p)
void __iomem *payload = ctlr->payload_base;
int idx = chan->index;
struct mhu_data_buf *data;
unsigned int *pp;
u32 status = readl(mbox_base + RX_STATUS(idx));
if (status && irq == chan->rx_irq) {
data = chan->data;
pp = (unsigned int *)data->rx_buf;
if (!data)
return IRQ_NONE; /* spurious */
if (data->rx_buf)

View File

@@ -115,7 +115,7 @@ EXPORT_SYMBOL(storage_ops_write);
int32_t amlkey_init_gen(uint8_t *seed, uint32_t len, int encrypt_type)
{
int32_t ret = 0;
uint32_t actual_size;
uint32_t actual_size = 0;
#ifndef OTHER_METHOD_CALL
ret = store_operation_init();
@@ -180,7 +180,7 @@ _out:
int32_t amlkey_init_m8b(uint8_t *seed, uint32_t len, int encrypt_type)
{
int32_t ret = 0;
uint32_t actual_size;
uint32_t actual_size = 0;
#ifndef OTHER_METHOD_CALL
ret = store_operation_init();

View File

@@ -1023,9 +1023,10 @@ static ssize_t list_show(struct class *cla,
/* show all the keys*/
for (index = 0; index < key_cnt; index++) {
unifykey = unifykey_find_item_by_id(&(ukdev->uk_header), index);
n += sprintf(&buf[n], "%02d: %s, %s, %x\n",
index, unifykey->name,
keydev[unifykey->dev], unifykey->permit);
if (unifykey != NULL)
n += sprintf(&buf[n], "%02d: %s, %s, %x\n",
index, unifykey->name,
keydev[unifykey->dev], unifykey->permit);
}
buf[n] = 0;
return n;
@@ -1339,8 +1340,8 @@ static ssize_t write_store(struct class *cla,
}
_out:
if (!IS_ERR_OR_NULL(keydata))
kfree(keydata);
kfree(keydata);
keydata = NULL;
return count;
}

View File

@@ -1,7 +1,9 @@
#ifndef __LINUX_MEMORY_HOTPLUG_H
#define __LINUX_MEMORY_HOTPLUG_H
#ifndef CONFIG_AMLOGIC_MODIFY
#include <linux/mmzone.h>
#endif
#include <linux/spinlock.h>
#include <linux/notifier.h>
#include <linux/bug.h>

View File

@@ -3,7 +3,9 @@
#include <linux/types.h>
#include <linux/percpu.h>
#ifndef CONFIG_AMLOGIC_MODIFY
#include <linux/mm.h>
#endif
#include <linux/mmzone.h>
#include <linux/vm_event_item.h>
#include <linux/atomic.h>