Skip to content

Commit dbd3e6e

Browse files
Wer-Wolfgroeck
authored andcommitted
hwmon: (dell-smm) Fix warning on /proc/i8k creation error
The removal function is called regardless of whether /proc/i8k was created successfully or not, the later causing a WARN() on module removal. Fix that by only registering the removal function if /proc/i8k was created successfully. Tested on a Inspiron 3505. Fixes: 039ae58 ("hwmon: Allow to compile dell-smm-hwmon driver without /proc/i8k") Signed-off-by: Armin Wolf <[email protected]> Acked-by: Pali Rohár <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 8383226 commit dbd3e6e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/hwmon/dell-smm-hwmon.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,9 @@ static void __init i8k_init_procfs(struct device *dev)
627627
{
628628
struct dell_smm_data *data = dev_get_drvdata(dev);
629629

630-
/* Register the proc entry */
631-
proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data);
632-
633-
devm_add_action_or_reset(dev, i8k_exit_procfs, NULL);
630+
/* Only register exit function if creation was successful */
631+
if (proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data))
632+
devm_add_action_or_reset(dev, i8k_exit_procfs, NULL);
634633
}
635634

636635
#else

0 commit comments

Comments
 (0)