[PATCH] staging: unisys: visorutil: Add a blank line
Add a blank line after declarations to meet kernel coding style. Signed-off-by: Masaru Nomura --- drivers/staging/unisys/visorutil/charqueue.c |2 ++ drivers/staging/unisys/visorutil/easyproc.c |6 ++ drivers/staging/unisys/visorutil/periodic_work.c |1 + drivers/staging/unisys/visorutil/procobjecttree.c |6 ++ 4 files changed, 15 insertions(+) diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index 61600e1..22241c7 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -41,6 +41,7 @@ CHARQUEUE *visor_charqueue_create(ulong nslots) { int alloc_size = sizeof(CHARQUEUE) + nslots + 1; CHARQUEUE *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); + if (cq == NULL) { ERRDRV("visor_charqueue_create allocation failed (alloc_size=%d)", alloc_size); @@ -75,6 +76,7 @@ EXPORT_SYMBOL_GPL(visor_charqueue_enqueue); BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) { BOOL b; + spin_lock(>lock); b = IS_EMPTY(charqueue); spin_unlock(>lock); diff --git a/drivers/staging/unisys/visorutil/easyproc.c b/drivers/staging/unisys/visorutil/easyproc.c index 43df598..3b38849 100644 --- a/drivers/staging/unisys/visorutil/easyproc.c +++ b/drivers/staging/unisys/visorutil/easyproc.c @@ -61,6 +61,7 @@ static struct proc_dir_entry * createProcDir(char *name, struct proc_dir_entry *parent) { struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent); + if (p == NULL) ERRDRV("failed to create /proc directory %s", name); return p; @@ -196,6 +197,7 @@ void visor_easyproc_InitDevice(struct easyproc_driver_info *pdriver, { if ((pdriver->ProcDeviceDir != NULL) && (p->procDevicexDir == NULL)) { char s[29]; + sprintf(s, "%d", devno); p->procDevicexDir = createProcDir(s, pdriver->ProcDeviceDir); p->devno = devno; @@ -267,6 +269,7 @@ void visor_easyproc_DeInitDevice(struct easyproc_driver_info *pdriver, struct easyproc_device_info *p, int devno) { size_t i; + for (i = 0; i < ARRAY_SIZE(p->device_property_info); i++) { if (p->device_property_info[i].procEntry != NULL) { struct easyproc_device_property_info *px = @@ -281,6 +284,7 @@ void visor_easyproc_DeInitDevice(struct easyproc_driver_info *pdriver, } if (p->procDevicexDir != NULL) { char s[29]; + sprintf(s, "%d", devno); remove_proc_entry(s, pdriver->ProcDeviceDir); p->procDevicexDir = NULL; @@ -334,6 +338,7 @@ static ssize_t proc_write_driver(struct file *file, const char __user *buffer, struct seq_file *seq = (struct seq_file *)file->private_data; struct easyproc_driver_info *p = NULL; char local_buf[256]; + if (seq == NULL) return 0; p = (struct easyproc_driver_info *)(seq->private); @@ -356,6 +361,7 @@ static ssize_t proc_write_device(struct file *file, const char __user *buffer, struct seq_file *seq = (struct seq_file *)file->private_data; struct easyproc_device_info *p = NULL; char local_buf[256]; + if (seq == NULL) return 0; p = (struct easyproc_device_info *)(seq->private); diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index 0251b83..38a60ce 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c @@ -92,6 +92,7 @@ EXPORT_SYMBOL_GPL(visor_periodic_work_destroy); BOOL visor_periodic_work_nextperiod(PERIODIC_WORK *periodic_work) { BOOL rc = FALSE; + write_lock(_work->lock); if (periodic_work->want_to_stop) { periodic_work->is_scheduled = FALSE; diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c index 2f874e0..5c8c95c 100644 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ b/drivers/staging/unisys/visorutil/procobjecttree.c @@ -95,6 +95,7 @@ static struct proc_dir_entry * createProcDir(const char *name, struct proc_dir_entry *parent) { struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent); + if (p == NULL) ERRDRV("failed to create /proc directory %s", name); return p; @@ -197,9 +198,11 @@ void visor_proc_DestroyType(MYPROCTYPE *type) return; if (type->procDirs != NULL) { int i = type->nNames-1; + while (i >= 0) { if (type->procDirs[i] != NULL) { struct proc_dir_entry *parent = NULL; + if (i == 0)
[PATCH] staging: unisys: visorutil: Add a blank line
Add a blank line after declarations to meet kernel coding style. Signed-off-by: Masaru Nomura massa.nom...@gmail.com --- drivers/staging/unisys/visorutil/charqueue.c |2 ++ drivers/staging/unisys/visorutil/easyproc.c |6 ++ drivers/staging/unisys/visorutil/periodic_work.c |1 + drivers/staging/unisys/visorutil/procobjecttree.c |6 ++ 4 files changed, 15 insertions(+) diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index 61600e1..22241c7 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -41,6 +41,7 @@ CHARQUEUE *visor_charqueue_create(ulong nslots) { int alloc_size = sizeof(CHARQUEUE) + nslots + 1; CHARQUEUE *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); + if (cq == NULL) { ERRDRV(visor_charqueue_create allocation failed (alloc_size=%d), alloc_size); @@ -75,6 +76,7 @@ EXPORT_SYMBOL_GPL(visor_charqueue_enqueue); BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) { BOOL b; + spin_lock(charqueue-lock); b = IS_EMPTY(charqueue); spin_unlock(charqueue-lock); diff --git a/drivers/staging/unisys/visorutil/easyproc.c b/drivers/staging/unisys/visorutil/easyproc.c index 43df598..3b38849 100644 --- a/drivers/staging/unisys/visorutil/easyproc.c +++ b/drivers/staging/unisys/visorutil/easyproc.c @@ -61,6 +61,7 @@ static struct proc_dir_entry * createProcDir(char *name, struct proc_dir_entry *parent) { struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent); + if (p == NULL) ERRDRV(failed to create /proc directory %s, name); return p; @@ -196,6 +197,7 @@ void visor_easyproc_InitDevice(struct easyproc_driver_info *pdriver, { if ((pdriver-ProcDeviceDir != NULL) (p-procDevicexDir == NULL)) { char s[29]; + sprintf(s, %d, devno); p-procDevicexDir = createProcDir(s, pdriver-ProcDeviceDir); p-devno = devno; @@ -267,6 +269,7 @@ void visor_easyproc_DeInitDevice(struct easyproc_driver_info *pdriver, struct easyproc_device_info *p, int devno) { size_t i; + for (i = 0; i ARRAY_SIZE(p-device_property_info); i++) { if (p-device_property_info[i].procEntry != NULL) { struct easyproc_device_property_info *px = @@ -281,6 +284,7 @@ void visor_easyproc_DeInitDevice(struct easyproc_driver_info *pdriver, } if (p-procDevicexDir != NULL) { char s[29]; + sprintf(s, %d, devno); remove_proc_entry(s, pdriver-ProcDeviceDir); p-procDevicexDir = NULL; @@ -334,6 +338,7 @@ static ssize_t proc_write_driver(struct file *file, const char __user *buffer, struct seq_file *seq = (struct seq_file *)file-private_data; struct easyproc_driver_info *p = NULL; char local_buf[256]; + if (seq == NULL) return 0; p = (struct easyproc_driver_info *)(seq-private); @@ -356,6 +361,7 @@ static ssize_t proc_write_device(struct file *file, const char __user *buffer, struct seq_file *seq = (struct seq_file *)file-private_data; struct easyproc_device_info *p = NULL; char local_buf[256]; + if (seq == NULL) return 0; p = (struct easyproc_device_info *)(seq-private); diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index 0251b83..38a60ce 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c @@ -92,6 +92,7 @@ EXPORT_SYMBOL_GPL(visor_periodic_work_destroy); BOOL visor_periodic_work_nextperiod(PERIODIC_WORK *periodic_work) { BOOL rc = FALSE; + write_lock(periodic_work-lock); if (periodic_work-want_to_stop) { periodic_work-is_scheduled = FALSE; diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c index 2f874e0..5c8c95c 100644 --- a/drivers/staging/unisys/visorutil/procobjecttree.c +++ b/drivers/staging/unisys/visorutil/procobjecttree.c @@ -95,6 +95,7 @@ static struct proc_dir_entry * createProcDir(const char *name, struct proc_dir_entry *parent) { struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent); + if (p == NULL) ERRDRV(failed to create /proc directory %s, name); return p; @@ -197,9 +198,11 @@ void visor_proc_DestroyType(MYPROCTYPE *type) return; if (type-procDirs != NULL) { int i = type-nNames-1; + while (i = 0) { if (type-procDirs[i] != NULL) { struct proc_dir_entry *parent = NULL; +