Skip to content

Commit 5fbf873

Browse files
committed
hwmon: (nzxt-kraken3) Bail out for unsupported device variants
Dan Carpenter reports: Commit cbeb479 ("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 <[email protected]> Closes: https://lore.kernel.org/linux-hwmon/[email protected]/ Cc: Jonas Malaco <[email protected]> Cc: Aleksa Savic <[email protected]> Fixes: cbeb479 ("hwmon: (nzxt-kraken3) Decouple device names from kinds") Acked-by: Jonas Malaco <[email protected]> Signed-off-by: Guenter Roeck <[email protected]>
1 parent c823378 commit 5fbf873

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/hwmon/nzxt-kraken3.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ static int kraken3_probe(struct hid_device *hdev, const struct hid_device_id *id
928928
device_name = "kraken2023elite";
929929
break;
930930
default:
931-
break;
931+
ret = -ENODEV;
932+
goto fail_and_close;
932933
}
933934

934935
priv->buffer = devm_kzalloc(&hdev->dev, MAX_REPORT_LENGTH, GFP_KERNEL);

0 commit comments

Comments
 (0)