diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dma-debug.c | 10 | ||||
-rw-r--r-- | lib/kobject.c | 14 | ||||
-rw-r--r-- | lib/mpi/mpi-bit.c | 5 |
3 files changed, 15 insertions, 14 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 13ef2338be41..518aea714d21 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -430,7 +430,7 @@ static struct dma_debug_entry *__dma_entry_alloc(void) | |||
430 | */ | 430 | */ |
431 | static struct dma_debug_entry *dma_entry_alloc(void) | 431 | static struct dma_debug_entry *dma_entry_alloc(void) |
432 | { | 432 | { |
433 | struct dma_debug_entry *entry = NULL; | 433 | struct dma_debug_entry *entry; |
434 | unsigned long flags; | 434 | unsigned long flags; |
435 | 435 | ||
436 | spin_lock_irqsave(&free_entries_lock, flags); | 436 | spin_lock_irqsave(&free_entries_lock, flags); |
@@ -438,11 +438,14 @@ static struct dma_debug_entry *dma_entry_alloc(void) | |||
438 | if (list_empty(&free_entries)) { | 438 | if (list_empty(&free_entries)) { |
439 | pr_err("DMA-API: debugging out of memory - disabling\n"); | 439 | pr_err("DMA-API: debugging out of memory - disabling\n"); |
440 | global_disable = true; | 440 | global_disable = true; |
441 | goto out; | 441 | spin_unlock_irqrestore(&free_entries_lock, flags); |
442 | return NULL; | ||
442 | } | 443 | } |
443 | 444 | ||
444 | entry = __dma_entry_alloc(); | 445 | entry = __dma_entry_alloc(); |
445 | 446 | ||
447 | spin_unlock_irqrestore(&free_entries_lock, flags); | ||
448 | |||
446 | #ifdef CONFIG_STACKTRACE | 449 | #ifdef CONFIG_STACKTRACE |
447 | entry->stacktrace.max_entries = DMA_DEBUG_STACKTRACE_ENTRIES; | 450 | entry->stacktrace.max_entries = DMA_DEBUG_STACKTRACE_ENTRIES; |
448 | entry->stacktrace.entries = entry->st_entries; | 451 | entry->stacktrace.entries = entry->st_entries; |
@@ -450,9 +453,6 @@ static struct dma_debug_entry *dma_entry_alloc(void) | |||
450 | save_stack_trace(&entry->stacktrace); | 453 | save_stack_trace(&entry->stacktrace); |
451 | #endif | 454 | #endif |
452 | 455 | ||
453 | out: | ||
454 | spin_unlock_irqrestore(&free_entries_lock, flags); | ||
455 | |||
456 | return entry; | 456 | return entry; |
457 | } | 457 | } |
458 | 458 | ||
diff --git a/lib/kobject.c b/lib/kobject.c index 21dee7c19afd..aeefa8bc8b1c 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -192,14 +192,14 @@ static int kobject_add_internal(struct kobject *kobj) | |||
192 | 192 | ||
193 | /* be noisy on error issues */ | 193 | /* be noisy on error issues */ |
194 | if (error == -EEXIST) | 194 | if (error == -EEXIST) |
195 | printk(KERN_ERR "%s failed for %s with " | 195 | WARN(1, "%s failed for %s with " |
196 | "-EEXIST, don't try to register things with " | 196 | "-EEXIST, don't try to register things with " |
197 | "the same name in the same directory.\n", | 197 | "the same name in the same directory.\n", |
198 | __func__, kobject_name(kobj)); | 198 | __func__, kobject_name(kobj)); |
199 | else | 199 | else |
200 | printk(KERN_ERR "%s failed for %s (%d)\n", | 200 | WARN(1, "%s failed for %s (error: %d parent: %s)\n", |
201 | __func__, kobject_name(kobj), error); | 201 | __func__, kobject_name(kobj), error, |
202 | dump_stack(); | 202 | parent ? kobject_name(parent) : "'none'"); |
203 | } else | 203 | } else |
204 | kobj->state_in_sysfs = 1; | 204 | kobj->state_in_sysfs = 1; |
205 | 205 | ||
diff --git a/lib/mpi/mpi-bit.c b/lib/mpi/mpi-bit.c index 2f526627e4f5..0c505361da19 100644 --- a/lib/mpi/mpi-bit.c +++ b/lib/mpi/mpi-bit.c | |||
@@ -177,8 +177,8 @@ int mpi_rshift(MPI x, MPI a, unsigned n) | |||
177 | */ | 177 | */ |
178 | int mpi_lshift_limbs(MPI a, unsigned int count) | 178 | int mpi_lshift_limbs(MPI a, unsigned int count) |
179 | { | 179 | { |
180 | mpi_ptr_t ap = a->d; | 180 | const int n = a->nlimbs; |
181 | int n = a->nlimbs; | 181 | mpi_ptr_t ap; |
182 | int i; | 182 | int i; |
183 | 183 | ||
184 | if (!count || !n) | 184 | if (!count || !n) |
@@ -187,6 +187,7 @@ int mpi_lshift_limbs(MPI a, unsigned int count) | |||
187 | if (RESIZE_IF_NEEDED(a, n + count) < 0) | 187 | if (RESIZE_IF_NEEDED(a, n + count) < 0) |
188 | return -ENOMEM; | 188 | return -ENOMEM; |
189 | 189 | ||
190 | ap = a->d; | ||
190 | for (i = n - 1; i >= 0; i--) | 191 | for (i = n - 1; i >= 0; i--) |
191 | ap[i + count] = ap[i]; | 192 | ap[i + count] = ap[i]; |
192 | for (i = 0; i < count; i++) | 193 | for (i = 0; i < count; i++) |