summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2024-05-12 19:07:01 +0300
committerGuenter Roeck <linux@roeck-us.net>2024-05-13 02:50:11 +0300
commit5fbf8734fb36cf67339f599f0e51747a6aff690c (patch)
tree7cc97cc4f286c3af59d4265e2437bd913a37742c /drivers/hwmon
parentc82337843dd7c0723e7ce2b86e5ed89d71f1c7c3 (diff)
downloadlinux-5fbf8734fb36cf67339f599f0e51747a6aff690c.tar.xz
hwmon: (nzxt-kraken3) Bail out for unsupported device variants
Dan Carpenter reports: Commit cbeb479ff4cd ("hwmon: (nzxt-kraken3) Decouple device names from kinds") from Apr 28, 2024 (linux-next), leads to the following Smatch static checker warning: drivers/hwmon/nzxt-kraken3.c:957 kraken3_probe() error: uninitialized symbol 'device_name'. Indeed, 'device_name' will be uninitizalized if an unknown product is encountered. In practice this should not matter because the driver should not instantiate on unknown products, but lets play safe and bail out if that happens. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/linux-hwmon/b1738c50-db42-40f0-a899-9c027c131ffb@moroto.mountain/ Cc: Jonas Malaco <jonas@protocubo.io> Cc: Aleksa Savic <savicaleksa83@gmail.com> Fixes: cbeb479ff4cd ("hwmon: (nzxt-kraken3) Decouple device names from kinds") Acked-by: Jonas Malaco <jonas@protocubo.io> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/nzxt-kraken3.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hwmon/nzxt-kraken3.c b/drivers/hwmon/nzxt-kraken3.c
index 0b3f04c740b0..00f3ac90a290 100644
--- a/drivers/hwmon/nzxt-kraken3.c
+++ b/drivers/hwmon/nzxt-kraken3.c
@@ -928,7 +928,8 @@ static int kraken3_probe(struct hid_device *hdev, const struct hid_device_id *id
device_name = "kraken2023elite";
break;
default:
- break;
+ ret = -ENODEV;
+ goto fail_and_close;
}
priv->buffer = devm_kzalloc(&hdev->dev, MAX_REPORT_LENGTH, GFP_KERNEL);