Skip to content

Commit c17e2cf

Browse files
committed
dma-debug: code style fixes
This patch changes the recent updates to dma-debug to conform with coding style guidelines of Linux and the -tip tree. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
1 parent 3123250 commit c17e2cf

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

‎lib/dma-debug.c‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ static int prealloc_memory(u32 num_entries)
501501
static ssize_t filter_read(struct file *file, char __user *user_buf,
502502
size_t count, loff_t *ppos)
503503
{
504-
unsigned long flags;
505504
char buf[NAME_MAX_LEN + 1];
505+
unsigned long flags;
506506
int len;
507507

508508
if (!current_driver_name[0])
@@ -523,9 +523,9 @@ static ssize_t filter_read(struct file *file, char __user *user_buf,
523523
static ssize_t filter_write(struct file *file, const char __user *userbuf,
524524
size_t count, loff_t *ppos)
525525
{
526-
unsigned long flags;
527526
char buf[NAME_MAX_LEN];
528-
size_t len = NAME_MAX_LEN - 1;
527+
unsigned long flags;
528+
size_t len;
529529
int i;
530530

531531
/*
@@ -534,7 +534,7 @@ static ssize_t filter_write(struct file *file, const char __user *userbuf,
534534
* disabled. Since copy_from_user can fault and may sleep we
535535
* need to copy to temporary buffer first
536536
*/
537-
len = min(count, len);
537+
len = min(count, NAME_MAX_LEN - 1);
538538
if (copy_from_user(buf, userbuf, len))
539539
return -EFAULT;
540540

@@ -1040,18 +1040,19 @@ EXPORT_SYMBOL(debug_dma_map_sg);
10401040

10411041
static int get_nr_mapped_entries(struct device *dev, struct scatterlist *s)
10421042
{
1043-
struct dma_debug_entry *entry;
1043+
struct dma_debug_entry *entry, ref;
10441044
struct hash_bucket *bucket;
10451045
unsigned long flags;
1046-
int mapped_ents = 0;
1047-
struct dma_debug_entry ref;
1046+
int mapped_ents;
10481047

1049-
ref.dev = dev;
1048+
ref.dev = dev;
10501049
ref.dev_addr = sg_dma_address(s);
1051-
ref.size = sg_dma_len(s),
1050+
ref.size = sg_dma_len(s),
1051+
1052+
bucket = get_hash_bucket(&ref, &flags);
1053+
entry = hash_bucket_find(bucket, &ref);
1054+
mapped_ents = 0;
10521055

1053-
bucket = get_hash_bucket(&ref, &flags);
1054-
entry = hash_bucket_find(bucket, &ref);
10551056
if (entry)
10561057
mapped_ents = entry->sg_mapped_ents;
10571058
put_hash_bucket(bucket, &flags);

0 commit comments

Comments
 (0)