Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751459AbdIMR3R (ORCPT ); Wed, 13 Sep 2017 13:29:17 -0400 Received: from bmailout1.hostsharing.net ([83.223.95.100]:54077 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751063AbdIMR3N (ORCPT ); Wed, 13 Sep 2017 13:29:13 -0400 X-Greylist: delayed 526 seconds by postgrey-1.27 at vger.kernel.org; Wed, 13 Sep 2017 13:29:12 EDT Date: Wed, 13 Sep 2017 19:20:24 +0200 From: Lukas Wunner To: Mario Limonciello Cc: dvhart@infradead.org, LKML , platform-driver-x86@vger.kernel.org, Richard Hughes , Yehezkel Bernat , Mika Westerberg Subject: Re: [PATCH v3] Add driver to force WMI Thunderbolt controller power status Message-ID: <20170913172024.GA8782@wunner.de> References: <1504884191-16528-1-git-send-email-mario.limonciello@dell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1504884191-16528-1-git-send-email-mario.limonciello@dell.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1002 Lines: 34 Sorry, late to the party. On Fri, Sep 08, 2017 at 10:23:11AM -0500, Mario Limonciello wrote: > + mode = hex_to_bin(buf[0]); > + if (mode == 0 || mode == 1) { > + status = wmi_evaluate_method(INTEL_WMI_THUNDERBOLT_GUID, 0, 1, > + &input, NULL); > + if (ACPI_FAILURE(status)) { > + pr_err("intel-wmi-thunderbolt: failed setting %s\n", > + buf); > + return -ENODEV; > + } > + } else { > + pr_err("intel-wmi-thunderbolt: unsupported mode: %d", mode); > + } > + return count; > +} Seems odd to allow user space to fill the log by writing invalid data to sysfs, likewise that success is returned in the else case. I'd drop both pr_err() and return -EINVAL in the else case. > +static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = { > + { .guid_string = INTEL_WMI_THUNDERBOLT_GUID }, > + { }, > +}; I'm not familiar with WMI, but don't you need a MODULE_DEVICE_TABLE here? How does user space know which module to load upon receiving the uevent? Thanks, Lukas