nvme: don't intialize hwmon for discovery controllers
authorSagi Grimberg <sagi@grimberg.me>
Thu, 14 Jan 2021 00:00:22 +0000 (16:00 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Jan 2021 17:27:30 +0000 (18:27 +0100)
commitc09af1ee7c232d22b0264fbc69b997b1b851ade8
treeee1b5696fcb2fc336dca1a24981e538d4b8a3a5e
parenta60c7aaaccf65c075aca32565c9d06a12fb0a95e
nvme: don't intialize hwmon for discovery controllers

commit 5ab25a32cd90ce561ac28b9302766e565d61304c upstream.

Discovery controllers usually don't support smart log page command.
So when we connect to the discovery controller we see this warning:
nvme nvme0: Failed to read smart log (error 24577)
nvme nvme0: new ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery", addr 192.168.123.1:8009
nvme nvme0: Removing ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery"

Introduce a new helper to understand if the controller is a discovery
controller and use this helper to skip nvme_init_hwmon (also use it in
other places that we check if the controller is a discovery controller).

Fixes: 400b6a7b13a3 ("nvme: Add hardware monitoring support")
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/host/core.c