From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935567AbdCJJ2k (ORCPT ); Fri, 10 Mar 2017 04:28:40 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39602 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934942AbdCJJ2a (ORCPT ); Fri, 10 Mar 2017 04:28:30 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kevin Folz , Guenter Roeck Subject: [PATCH 4.10 033/167] hwmon: (it87) Ensure that pwm control cache is current before updating values Date: Fri, 10 Mar 2017 10:07:56 +0100 Message-Id: <20170310083958.958590669@linuxfoundation.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170310083956.767605269@linuxfoundation.org> References: <20170310083956.767605269@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Guenter Roeck commit 82dbe987b70042b340f851bdc969a971081e5f02 upstream. If sensor attributes were never read, the pwm control data has not been initiialized, which can cause wrong driver behavior. Ensure that cached data is current before acting on it. Reported-by: Kevin Folz Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/it87.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -1354,6 +1354,7 @@ static ssize_t set_pwm(struct device *de return -EINVAL; mutex_lock(&data->update_lock); + it87_update_pwm_ctrl(data, nr); if (has_newer_autopwm(data)) { /* * If we are in automatic mode, the PWM duty cycle register @@ -1466,6 +1467,7 @@ static ssize_t set_pwm_temp_map(struct d } mutex_lock(&data->update_lock); + it87_update_pwm_ctrl(data, nr); data->pwm_temp_map[nr] = reg; /* * If we are in automatic mode, write the temp mapping immediately;