aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-cache-policy.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2013-10-01 18:35:39 -0400
committerMike Snitzer <snitzer@redhat.com>2013-11-09 18:20:18 -0500
commit4cb3e1db21a94781bbf05238687c3e8a715ab2f9 (patch)
treecb1f1a00806693dedcb98eec12f81a1598d36924 /drivers/md/dm-cache-policy.c
parentdd8b0c2096e53b336324e99455efcc498599ba0f (diff)
dm cache: return -EINVAL if the user specifies unknown cache policy
Return -EINVAL when the specified cache policy is unknown rather than returning -ENOMEM. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-cache-policy.c')
-rw-r--r--drivers/md/dm-cache-policy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/dm-cache-policy.c b/drivers/md/dm-cache-policy.c
index 21c03c570c06..d80057968407 100644
--- a/drivers/md/dm-cache-policy.c
+++ b/drivers/md/dm-cache-policy.c
@@ -119,13 +119,13 @@ struct dm_cache_policy *dm_cache_policy_create(const char *name,
119 type = get_policy(name); 119 type = get_policy(name);
120 if (!type) { 120 if (!type) {
121 DMWARN("unknown policy type"); 121 DMWARN("unknown policy type");
122 return NULL; 122 return ERR_PTR(-EINVAL);
123 } 123 }
124 124
125 p = type->create(cache_size, origin_size, cache_block_size); 125 p = type->create(cache_size, origin_size, cache_block_size);
126 if (!p) { 126 if (!p) {
127 put_policy(type); 127 put_policy(type);
128 return NULL; 128 return ERR_PTR(-ENOMEM);
129 } 129 }
130 p->private = type; 130 p->private = type;
131 131