Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3541486pxj; Mon, 24 May 2021 09:00:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy85bmRA+KVEu2fbN2+qgZhnCLKq1giQ92KcLZ+uC5tk6AD1oStXmzakt64FyYkp2Nw3jD/ X-Received: by 2002:a92:650d:: with SMTP id z13mr13327749ilb.193.1621872054836; Mon, 24 May 2021 09:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872054; cv=none; d=google.com; s=arc-20160816; b=DCNfGCE8DguN0wILLtg4hGMVCaGggsHQhmNfjbrhr10d+MSyAImE74w5cUXFmvNnFC iMc2Ky/DR3F9S/Fo+qUzCs9KbN+c3JiSMbMk10qnpjijIUrC9qW3fDbwF4B1qq+mn9pu JXuHeedtaTcKs/Rt3C1AXcilpdKpGmANQJlUnQznciZxsWPRVt0DuRqpP3h4YjAg5Syy x0l3eJ5YQcD4UhR4x7493kHmJiOzh0SCtaSRrp91A3xN/NDN12Mv95wQtF523s9LcoZg w8qt7veg20cQ5Hpp9+B4xBKnsHZM4q+yOfNP9EfeVMSvEpPn4KNqQLIUW0MMfRFMdCC0 ywzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4PRdoXgIeY9x+IvcavcrTO3MX5EYt0ZNsjI1JDJFstg=; b=waJvq/wRNkaV2r6sVI/6lewkCidinSjtffx4U/VWzUZeBkkCs9P8Z6NXJh3AmxoWhx Jjjuh/DDCPCMyh9+3/gKr74mfqkjSifBdxzKnR1CcyW7rW5xRH8bnU4m1+FiG/tyKV5A /Gv3LBx4BVzehTZ69QPVrRwd2wXHvSC7O7i27h/YJQr4TPUp0iC9NF2EnOENDqexnA+B T1boYN8VK9+IIisIjIdcQu3l6VdS9vaRKmPYdFOgW50JCqthVf1f9WQt012K6PQR6HYC 3sC52TfQqchzO5HcwQfWyoEECkSQ2wgjdBoUz6SOsIBJVrvLICTCyuriBd5AlAunWpBs 620g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E5dN7DMm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si14679077jak.80.2021.05.24.09.00.41; Mon, 24 May 2021 09:00:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E5dN7DMm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235380AbhEXQBe (ORCPT + 99 others); Mon, 24 May 2021 12:01:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:38624 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234326AbhEXPwC (ORCPT ); Mon, 24 May 2021 11:52:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EAA9C6162E; Mon, 24 May 2021 15:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870725; bh=Oo3ztTKrT4fQjPNpGhU0AtG7+1T9vobNl4gDim5UShs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E5dN7DMm9MQLQgjeUYKU7y7OUH8aMXS22pEUrTOQS/BFJK2905G1PTQbV3GdWlRHw Kvxq0kgjLR0pnZ7ZRjM7xzgdMlXz9K4f5IkuDLSQDjy35F17bypexp+2Si7q8tRlCf A1KjJv+zYxHJ0rq6XXq4BF4XZcRZvOf8svhbTnEc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" Subject: [PATCH 5.4 62/71] ics932s401: fix broken handling of errors when word reading fails Date: Mon, 24 May 2021 17:26:08 +0200 Message-Id: <20210524152328.466775008@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152326.447759938@linuxfoundation.org> References: <20210524152326.447759938@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Darrick J. Wong commit a73b6a3b4109ce2ed01dbc51a6c1551a6431b53c upstream. In commit b05ae01fdb89, someone tried to make the driver handle i2c read errors by simply zeroing out the register contents, but for some reason left unaltered the code that sets the cached register value the function call return value. The original patch was authored by a member of the Underhanded Mangle-happy Nerds, I'm not terribly surprised. I don't have the hardware anymore so I can't test this, but it seems like a pretty obvious API usage fix to me... Fixes: b05ae01fdb89 ("misc/ics932s401: Add a missing check to i2c_smbus_read_word_data") Signed-off-by: Darrick J. Wong Link: https://lore.kernel.org/r/20210428222534.GJ3122264@magnolia Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ics932s401.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/misc/ics932s401.c +++ b/drivers/misc/ics932s401.c @@ -134,7 +134,7 @@ static struct ics932s401_data *ics932s40 for (i = 0; i < NUM_MIRRORED_REGS; i++) { temp = i2c_smbus_read_word_data(client, regs_to_copy[i]); if (temp < 0) - data->regs[regs_to_copy[i]] = 0; + temp = 0; data->regs[regs_to_copy[i]] = temp >> 8; }