]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
lightnvm: pblk: check for supported version
authorJavier González <javier@cnexlabs.com>
Thu, 29 Mar 2018 22:05:18 +0000 (00:05 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 29 Mar 2018 23:29:09 +0000 (17:29 -0600)
At this point, only 1.2 spec is supported, thus check for it. Also,
since device-side L2P is only supported in the 1.2 spec, make sure to
only check its value under 1.2.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/lightnvm/pblk-init.c

index 4656d1ff81a68a5ae3563ad4b0f06a31485c2cb1..34ff47705293ad35f9ea1e19e2f520043de77a88 100644 (file)
@@ -1016,9 +1016,15 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
        struct pblk *pblk;
        int ret;
 
-       if (dev->geo.dom & NVM_RSP_L2P) {
+       if (geo->version != NVM_OCSSD_SPEC_12) {
+               pr_err("pblk: OCSSD version not supported (%u)\n",
+                                                       geo->version);
+               return ERR_PTR(-EINVAL);
+       }
+
+       if (geo->version == NVM_OCSSD_SPEC_12 && geo->dom & NVM_RSP_L2P) {
                pr_err("pblk: host-side L2P table not supported. (%x)\n",
-                                                       dev->geo.dom);
+                                                       geo->dom);
                return ERR_PTR(-EINVAL);
        }