diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/iommu-common.c | 6 | ||||
-rw-r--r-- | lib/rhashtable.c | 5 | ||||
-rw-r--r-- | lib/string_helpers.c | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/lib/iommu-common.c b/lib/iommu-common.c index ff19f66d3f7f..b1c93e94ca7a 100644 --- a/lib/iommu-common.c +++ b/lib/iommu-common.c | |||
@@ -21,8 +21,7 @@ static DEFINE_PER_CPU(unsigned int, iommu_hash_common); | |||
21 | 21 | ||
22 | static inline bool need_flush(struct iommu_map_table *iommu) | 22 | static inline bool need_flush(struct iommu_map_table *iommu) |
23 | { | 23 | { |
24 | return (iommu->lazy_flush != NULL && | 24 | return ((iommu->flags & IOMMU_NEED_FLUSH) != 0); |
25 | (iommu->flags & IOMMU_NEED_FLUSH) != 0); | ||
26 | } | 25 | } |
27 | 26 | ||
28 | static inline void set_flush(struct iommu_map_table *iommu) | 27 | static inline void set_flush(struct iommu_map_table *iommu) |
@@ -211,7 +210,8 @@ unsigned long iommu_tbl_range_alloc(struct device *dev, | |||
211 | goto bail; | 210 | goto bail; |
212 | } | 211 | } |
213 | } | 212 | } |
214 | if (n < pool->hint || need_flush(iommu)) { | 213 | if (iommu->lazy_flush && |
214 | (n < pool->hint || need_flush(iommu))) { | ||
215 | clear_flush(iommu); | 215 | clear_flush(iommu); |
216 | iommu->lazy_flush(iommu); | 216 | iommu->lazy_flush(iommu); |
217 | } | 217 | } |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index cc0c69710dcf..a54ff8949f91 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -187,10 +187,7 @@ static int rhashtable_rehash_one(struct rhashtable *ht, unsigned int old_hash) | |||
187 | head = rht_dereference_bucket(new_tbl->buckets[new_hash], | 187 | head = rht_dereference_bucket(new_tbl->buckets[new_hash], |
188 | new_tbl, new_hash); | 188 | new_tbl, new_hash); |
189 | 189 | ||
190 | if (rht_is_a_nulls(head)) | 190 | RCU_INIT_POINTER(entry->next, head); |
191 | INIT_RHT_NULLS_HEAD(entry->next, ht, new_hash); | ||
192 | else | ||
193 | RCU_INIT_POINTER(entry->next, head); | ||
194 | 191 | ||
195 | rcu_assign_pointer(new_tbl->buckets[new_hash], entry); | 192 | rcu_assign_pointer(new_tbl->buckets[new_hash], entry); |
196 | spin_unlock(new_bucket_lock); | 193 | spin_unlock(new_bucket_lock); |
diff --git a/lib/string_helpers.c b/lib/string_helpers.c index 54036ce2e2dd..5939f63d90cd 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c | |||
@@ -59,7 +59,11 @@ void string_get_size(u64 size, u64 blk_size, const enum string_size_units units, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | exp = divisor[units] / (u32)blk_size; | 61 | exp = divisor[units] / (u32)blk_size; |
62 | if (size >= exp) { | 62 | /* |
63 | * size must be strictly greater than exp here to ensure that remainder | ||
64 | * is greater than divisor[units] coming out of the if below. | ||
65 | */ | ||
66 | if (size > exp) { | ||
63 | remainder = do_div(size, divisor[units]); | 67 | remainder = do_div(size, divisor[units]); |
64 | remainder *= blk_size; | 68 | remainder *= blk_size; |
65 | i++; | 69 | i++; |