Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3542524pxj; Mon, 24 May 2021 09:01:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEqRULtZ+gsJ87gSWnbpG7V7G4afZEbutjy4Kf2IDDBx1uZRCyVjqY7+2thBdp5pG9vGsJ X-Received: by 2002:a05:6e02:11b3:: with SMTP id 19mr16396254ilj.41.1621872116950; Mon, 24 May 2021 09:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872116; cv=none; d=google.com; s=arc-20160816; b=hGnoCPlGnMUS6jCFkQUeI/y0V+GrAgwhZH0XRc5y6+R6Wb0gjHZnf5LYsk6JWzuuJA +oQfgmCrGl25MrtcTp/9Kk99nFFnsuhXVqw0ersqa0xzJphNloH7U3CxteNIthnGO5kg fr4McMLEZ82hDa1g8bhC+DZlnfUfG6DhyUrBNutvSZqay3H6tCGCARfeS47XkNsM9eck cVuGmLxVSfdq1xEgXj5mPpMjRe3i1ccGknd8Lfc5pzYS3nFTnxyPXur+9AHmXyUZmvql E1HnoshrCttvANWmioMxSjQ86Zb0+Xg3JOnFVqQpXqqentnasuMk+0S3o7z5Cftly7Jp kKKg== 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=kg9E2K3ruBCgXuftMw7rGkuUk2wWFFjabMUJELZNiiNiRdDPxSpGuQm8CmIUrPuewp 6A1hYX5y4jwv+YVSltdye+RQC5M+LjqkbV+V6q4VRFkwMMYbDUc15sEPHBoMa2dQX1MP aBtj0eJULzbGRYW9EA46AWeXV+bpmToKdKPV9iOJoXkykm7O/OcYp7nf4b1f/UauAZIc Czw9ElymhFfhbeit5mMxNCk+xZohKfI5nwOutXvvAs/L3SddO27xxnoiN9ube7RdXTRo mFFE+uSaHxF5T4gUpPFZAywBJIADy3QQ8N/mpsa/J9jF/ZiNaeOL0uDQmGcZ2kmNK48H xmzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Iq1X9fyO; 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 b15si15573775jat.59.2021.05.24.09.01.43; Mon, 24 May 2021 09:01:56 -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=Iq1X9fyO; 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 S235897AbhEXQCk (ORCPT + 99 others); Mon, 24 May 2021 12:02:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:40482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235152AbhEXPzz (ORCPT ); Mon, 24 May 2021 11:55:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 16B7761456; Mon, 24 May 2021 15:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870946; bh=Oo3ztTKrT4fQjPNpGhU0AtG7+1T9vobNl4gDim5UShs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iq1X9fyOCX1SlzHcmkvOwCxn+r3jn1bG7HnGKoXzK3GDRQevpe64jV/GiFcd5JhwR KvqRH8BpKrDsdFcZh3R7JliviPDP5mI6cMU1tW4xLC4ozIHpHo97drx81l4N9N5U/r u02FuwxPOfvK3LIjq0Crj+Ea3bb9dNIV2Y/MfQF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" Subject: [PATCH 5.10 091/104] ics932s401: fix broken handling of errors when word reading fails Date: Mon, 24 May 2021 17:26:26 +0200 Message-Id: <20210524152335.866763702@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152332.844251980@linuxfoundation.org> References: <20210524152332.844251980@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; }