]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Replace obsolete simple_strtoul() with kstrtou8/kstrtouint.
authormajianpeng <majianpeng@gmail.com>
Tue, 24 Jul 2012 23:25:12 +0000 (09:25 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 24 Jul 2012 23:25:12 +0000 (09:25 +1000)
Signed-off-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-crypt.c
drivers/md/dm-exception-store.c
drivers/md/dm-stripe.c

index 3f06df59fd824022fd80a9c77551178660909eb6..e2b32401ecc7b3345c148b9518885ce466d849af 100644 (file)
@@ -1241,7 +1241,6 @@ static void kcryptd_queue_crypt(struct dm_crypt_io *io)
 static int crypt_decode_key(u8 *key, char *hex, unsigned int size)
 {
        char buffer[3];
-       char *endp;
        unsigned int i;
 
        buffer[2] = '\0';
@@ -1250,9 +1249,7 @@ static int crypt_decode_key(u8 *key, char *hex, unsigned int size)
                buffer[0] = *hex++;
                buffer[1] = *hex++;
 
-               key[i] = (u8)simple_strtoul(buffer, &endp, 16);
-
-               if (endp != &buffer[2])
+               if (kstrtou8(buffer, 16, &key[i]))
                        return -EINVAL;
        }
 
index aa70f7d43a1ab87750cee933d244eb098cb8d92b..ebaa4f803eec3a08a0cd9fcd9a9a1b933618c50c 100644 (file)
@@ -142,24 +142,19 @@ EXPORT_SYMBOL(dm_exception_store_type_unregister);
 static int set_chunk_size(struct dm_exception_store *store,
                          const char *chunk_size_arg, char **error)
 {
-       unsigned long chunk_size_ulong;
-       char *value;
+       unsigned chunk_size;
 
-       chunk_size_ulong = simple_strtoul(chunk_size_arg, &value, 10);
-       if (*chunk_size_arg == '\0' || *value != '\0' ||
-           chunk_size_ulong > UINT_MAX) {
+       if (kstrtouint(chunk_size_arg, 10, &chunk_size)) {
                *error = "Invalid chunk size";
                return -EINVAL;
        }
 
-       if (!chunk_size_ulong) {
+       if (!chunk_size) {
                store->chunk_size = store->chunk_mask = store->chunk_shift = 0;
                return 0;
        }
 
-       return dm_exception_store_set_chunk_size(store,
-                                                (unsigned) chunk_size_ulong,
-                                                error);
+       return dm_exception_store_set_chunk_size(store, chunk_size, error);
 }
 
 int dm_exception_store_set_chunk_size(struct dm_exception_store *store,
index 35c94ff24ad5867917ed715a8ce387fbb8d3b150..183db5d3e48e4d6f57074c7642be2f36b44c985b 100644 (file)
@@ -99,7 +99,6 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
        sector_t width;
        uint32_t stripes;
        uint32_t chunk_size;
-       char *end;
        int r;
        unsigned int i;
 
@@ -108,14 +107,12 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
                return -EINVAL;
        }
 
-       stripes = simple_strtoul(argv[0], &end, 10);
-       if (!stripes || *end) {
+       if (kstrtouint(argv[0], 10, &stripes) || !stripes) {
                ti->error = "Invalid stripe count";
                return -EINVAL;
        }
 
-       chunk_size = simple_strtoul(argv[1], &end, 10);
-       if (*end) {
+       if (kstrtouint(argv[1], 10, &chunk_size)) {
                ti->error = "Invalid chunk_size";
                return -EINVAL;
        }