Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck...
[linux-drm-fsl-dcu.git] / fs / btrfs / volumes.c
index f492f7eabf29e9df47ba88f7d8c0e230066d515c..92303f42baaa92d5d845edddff1f8600fc46518e 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/raid/pq.h>
 #include <linux/semaphore.h>
 #include <asm/div64.h>
-#include "compat.h"
 #include "ctree.h"
 #include "extent_map.h"
 #include "disk-io.h"
@@ -2553,8 +2552,7 @@ again:
                failed = 0;
                retried = true;
                goto again;
-       } else if (failed && retried) {
-               WARN_ON(1);
+       } else if (WARN_ON(failed && retried)) {
                ret = -ENOSPC;
        }
 error:
@@ -4903,7 +4901,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
                        num_stripes = map->num_stripes;
                        max_errors = nr_parity_stripes(map);
 
-                       raid_map = kmalloc(sizeof(u64) * num_stripes,
+                       raid_map = kmalloc_array(num_stripes, sizeof(u64),
                                           GFP_NOFS);
                        if (!raid_map) {
                                ret = -ENOMEM;
@@ -5396,17 +5394,15 @@ static int bio_size_ok(struct block_device *bdev, struct bio *bio,
 {
        struct bio_vec *prev;
        struct request_queue *q = bdev_get_queue(bdev);
-       unsigned short max_sectors = queue_max_sectors(q);
+       unsigned int max_sectors = queue_max_sectors(q);
        struct bvec_merge_data bvm = {
                .bi_bdev = bdev,
                .bi_sector = sector,
                .bi_rw = bio->bi_rw,
        };
 
-       if (bio->bi_vcnt == 0) {
-               WARN_ON(1);
+       if (WARN_ON(bio->bi_vcnt == 0))
                return 1;
-       }
 
        prev = &bio->bi_io_vec[bio->bi_vcnt - 1];
        if (bio_sectors(bio) > max_sectors)
@@ -5639,10 +5635,8 @@ struct btrfs_device *btrfs_alloc_device(struct btrfs_fs_info *fs_info,
        struct btrfs_device *dev;
        u64 tmp;
 
-       if (!devid && !fs_info) {
-               WARN_ON(1);
+       if (WARN_ON(!devid && !fs_info))
                return ERR_PTR(-EINVAL);
-       }
 
        dev = __alloc_device();
        if (IS_ERR(dev))