summaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-cache-target.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-target.c
parentdd8b0c2096e53b336324e99455efcc498599ba0f (diff)
downloadop-kernel-dev-4cb3e1db21a94781bbf05238687c3e8a715ab2f9.zip
op-kernel-dev-4cb3e1db21a94781bbf05238687c3e8a715ab2f9.tar.gz
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-target.c')
-rw-r--r--drivers/md/dm-cache-target.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 50afdf7..81fe857 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -1879,14 +1879,15 @@ static int set_config_values(struct cache *cache, int argc, const char **argv)
static int create_cache_policy(struct cache *cache, struct cache_args *ca,
char **error)
{
- cache->policy = dm_cache_policy_create(ca->policy_name,
- cache->cache_size,
- cache->origin_sectors,
- cache->sectors_per_block);
- if (!cache->policy) {
+ struct dm_cache_policy *p = dm_cache_policy_create(ca->policy_name,
+ cache->cache_size,
+ cache->origin_sectors,
+ cache->sectors_per_block);
+ if (IS_ERR(p)) {
*error = "Error creating cache's policy";
- return -ENOMEM;
+ return PTR_ERR(p);
}
+ cache->policy = p;
return 0;
}
OpenPOWER on IntegriCloud