All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	pakki001@umn.edu, arnd@arndb.de
Subject: Re: [PATCH] ics932s401: fix broken handling of errors when word reading fails
Date: Thu, 29 Apr 2021 09:12:28 +0200	[thread overview]
Message-ID: <YIpcXKQtn6mLcU+o@kroah.com> (raw)
In-Reply-To: <20210428222534.GJ3122264@magnolia>

On Wed, Apr 28, 2021 at 03:25:34PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> 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 <djwong@kernel.org>
> ---
>  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;
>  	}
>  

Many thanks for looking at this again, I'll add it to my series of
patches for "reviewing all the crap and fixing it up" that I will be
working to get merged for 5.13-final.

greg k-h

      parent reply	other threads:[~2021-04-29  7:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28 22:25 [PATCH] ics932s401: fix broken handling of errors when word reading fails Darrick J. Wong
2021-04-28 22:46 ` Matthew Wilcox
2021-04-29  1:03   ` Darrick J. Wong
2021-04-29  1:54     ` Matthew Wilcox
2021-04-29  3:20     ` Theodore Ts'o
2021-04-29  7:12 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YIpcXKQtn6mLcU+o@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=djwong@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pakki001@umn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.