Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3550179pxj; Mon, 24 May 2021 09:10:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3XPvZDmnKNR6oFy4yyetzwDKCECuoaJmBYSdjf9s6y+aww1n+UqeDnOxSyIrHl8yZCHXq X-Received: by 2002:a02:69ca:: with SMTP id e193mr25253497jac.130.1621872603414; Mon, 24 May 2021 09:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872603; cv=none; d=google.com; s=arc-20160816; b=A1xi8bN5b+JAPzxV+MJVjDeZ7agfKhlJdV9zVMBY972RrTq2bwbgkjCnArlyi8A9fj oklHGuOiBr5VkdDr0lW93BLKON2khFcP7c8ACkQrsFxub9mZA/Y8fY8/5tmUPZM0VZ6h 9DVPP7ujYiwObPcXjnzqoXAEuJMHQxOpVG7YY6bNnvpJ78EmpHFMYmAZ1UcEhKCas3bI 8XBLXwr1E5yRT19aoNV7U+qnJV4TPgCZVL3KGjAq5LiuXLo4brFyjDcd+kGKXAsSTrV1 ylSandG35PgsuAzwGSwXZ6VcmKXWVML/CRLnkeF/kE/Z4U8bofnUOGlCgT53Hj+mdmWy +7hA== 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=b4/PEXvCOgkvaViM83NRve3Jswanjoo8+yXA7CzsrPI=; b=MbGjPVZF0n+2mZ1yWzyVE/9hW+FEgVLM1/wyU79rJshLZbF6eED72blfhPll3r53Sg vItPcDDJcqQ4z+43+YpO8KNmqhUlyn8xyh8bMF3hA1hlTZgiKCNZrG4/vMhxt9hmnH8l 2tlnBynK+hkV33WDCbHWgqVAMnxgfU2+Qk0dXs/3Df3ADAGTGQDDGF1SJR+fPj1Y7yhm 8G6eL5TBYzG24nDFErb6ptPGom5SvvNxgx2IF8YMpEJUI3IkiK6zFHJZQ7CcmK/nVaof xkXkSE0LsywCW5Qydm+EF64Hkwy7hQtRU3XpeYdEVrtdk8FGvKG/70t6850FW7iOaIMX tcsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ySGQwvK4; 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 h13si6694493iop.97.2021.05.24.09.09.49; Mon, 24 May 2021 09:10:03 -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=ySGQwvK4; 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 S237749AbhEXQJQ (ORCPT + 99 others); Mon, 24 May 2021 12:09:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:43814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235166AbhEXQA7 (ORCPT ); Mon, 24 May 2021 12:00:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 64CBF61997; Mon, 24 May 2021 15:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871187; bh=Ok3xHk24E0MG7zMOkmSPgpqGag+9LrLlP3Kz3+UnxKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ySGQwvK4rGHQBs12JAqhrj3VqV2YApHpMveqOG9RkoNcpi9V6GK65roKr7ldPOvQl OIdBFpTLjzkL5b+m/lJGCrvDFKWHtimFGsMrKZmrqHmdVp+84y9s2Zt2XvHflSuJbI ciyRotDhSL6WY6ey773cCHrHTgqumQ4SSQwI37C4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" Subject: [PATCH 5.12 114/127] ics932s401: fix broken handling of errors when word reading fails Date: Mon, 24 May 2021 17:27:11 +0200 Message-Id: <20210524152338.716383034@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@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(-) diff --git a/drivers/misc/ics932s401.c b/drivers/misc/ics932s401.c index 2bdf560ee681..0f9ea75b0b18 100644 --- a/drivers/misc/ics932s401.c +++ b/drivers/misc/ics932s401.c @@ -134,7 +134,7 @@ static struct ics932s401_data *ics932s401_update_device(struct device *dev) 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; } -- 2.31.1