From eec736247380758859347c4f5209ef7475e7458d Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Tue, 6 Aug 2013 07:39:11 -0400 Subject: [PATCH] dm stats: fix __check_shared_memory due to bogus checkpatch "fix" also fix dm_stats_create to return r rather than -ENOMEM --- drivers/md/dm-stats.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c index 41c06ed..ea0e64f 100644 --- a/drivers/md/dm-stats.c +++ b/drivers/md/dm-stats.c @@ -58,15 +58,14 @@ struct dm_stats_last_position { * and crash. To prevent the crash we account all used memory. We fail if we * exhaust 1/4 of all memory or 1/2 of vmalloc space. */ - -#define DM_STATS_MEMORY_RATIO (1 / 4) -#define DM_STATS_VMALLOC_RATIO (1 / 2) +#define DM_STATS_MEMORY_RATIO 1 / 4 +#define DM_STATS_VMALLOC_RATIO 1 / 2 static DEFINE_SPINLOCK(shared_memory_lock); static size_t shared_memory_amount; -static bool _check_shared_memory(size_t alloc_size) +static bool __check_shared_memory(size_t alloc_size) { size_t a; @@ -88,7 +87,7 @@ static bool check_shared_memory(size_t alloc_size) spin_lock_irq(&shared_memory_lock); - ret = _check_shared_memory(alloc_size); + ret = __check_shared_memory(alloc_size); spin_unlock_irq(&shared_memory_lock); @@ -99,7 +98,7 @@ static bool claim_shared_memory(size_t alloc_size) { spin_lock_irq(&shared_memory_lock); - if (!_check_shared_memory(alloc_size)) { + if (!__check_shared_memory(alloc_size)) { spin_unlock_irq(&shared_memory_lock); return false; } @@ -322,7 +321,7 @@ static int dm_stats_create(struct dm_stats *st, sector_t start, sector_t end, free_ret: dm_stat_free(&s->rcu_head); - return -ENOMEM; + return r; } static struct dm_stat *__dm_stats_find(struct dm_stats *st, int id) -- 1.7.1