nvmet: Use nvmet_is_port_enabled helper for pi_enable
authorIsrael Rukshin <israelr@nvidia.com>
Thu, 7 Jan 2021 15:34:13 +0000 (17:34 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 2 Feb 2021 09:26:10 +0000 (10:26 +0100)
Remove code duplication.

Signed-off-by: Israel Rukshin <israelr@nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/configfs.c

index c61ffd76706263cb6c6939df0c9a0c9fa762894b..b2021bf6cee5a423f841677dadb9666e1497ba4e 100644 (file)
@@ -266,10 +266,8 @@ static ssize_t nvmet_param_pi_enable_store(struct config_item *item,
        if (strtobool(page, &val))
                return -EINVAL;
 
-       if (port->enabled) {
-               pr_err("Disable port before setting pi_enable value.\n");
+       if (nvmet_is_port_enabled(port, __func__))
                return -EACCES;
-       }
 
        port->pi_enable = val;
        return count;