From: Christoph Hellwig Date: Tue, 18 Aug 2020 07:11:31 +0000 (+0200) Subject: nvme: just check the status code type in nvme_is_path_error X-Git-Tag: v5.15~2786^2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e41f3bd26f79463c07aebf062a0a77f1fd39b2b;p=platform%2Fkernel%2Flinux-starfive.git nvme: just check the status code type in nvme_is_path_error Check the SCT sub-field for a path related status instead of enumerating invididual status code. As of NVMe 1.4 this adds "Internal Path Error" and "Controller Pathing Error" to the list, but it also future proofs for additional status codes added to the category. Suggested-by: Chao Leng Signed-off-by: Christoph Hellwig Reviewed-by: Mike Snitzer Signed-off-by: Sagi Grimberg Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 4ff6fd289082..e9cf29449dd1 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -537,16 +537,8 @@ static inline bool nvme_is_ana_error(u16 status) static inline bool nvme_is_path_error(u16 status) { - switch (status & 0x7ff) { - case NVME_SC_HOST_PATH_ERROR: - case NVME_SC_HOST_ABORTED_CMD: - case NVME_SC_ANA_TRANSITION: - case NVME_SC_ANA_INACCESSIBLE: - case NVME_SC_ANA_PERSISTENT_LOSS: - return true; - default: - return false; - } + /* check for a status code type of 'path related status' */ + return (status & 0x700) == 0x300; } /*