All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Brad Campbell <brad@fnarfbargle.com>
Cc: Henrik Rydberg <rydberg@bitmath.org>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] hwmon: (applesmc) Fix smc_sane() function
Date: Tue, 17 Nov 2020 14:02:59 +0000	[thread overview]
Message-ID: <20201117140259.GG18329@kadam> (raw)
In-Reply-To: <5000a18a-1aa1-e9b0-c51a-80f65654c65b@fnarfbargle.com>

On Tue, Nov 17, 2020 at 08:58:47PM +1100, Brad Campbell wrote:
> On 17/11/20 6:24 pm, Dan Carpenter wrote:
> > This test is reversed so the function will return without sending
> > the APPLESMC_READ_CMD or completing the rest of the function.
> 
> That is as designed. The routine looks at the busy line and if it's
> already in the right state then it simply ends. If not then it tries
> to "re-align" the state machine by sending a new command.

Ah.  Ok.  It looked like a typo.  These "if (!ret) return ret;" typos
are surprisingly common so I review them every time they are added.
It's a static analysis warning, that I haven't published.  I kind of
feel like it would be more clearly intentional if it were written like
so:

	ret = wait_status(0, SMC_STATUS_BUSY);
	if (!ret)
		return 0;

But I try not to get too bogged down with style so let's leave it.

regards,
dan carpenter

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Brad Campbell <brad@fnarfbargle.com>
Cc: Henrik Rydberg <rydberg@bitmath.org>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-hwmon@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] hwmon: (applesmc) Fix smc_sane() function
Date: Tue, 17 Nov 2020 17:02:59 +0300	[thread overview]
Message-ID: <20201117140259.GG18329@kadam> (raw)
In-Reply-To: <5000a18a-1aa1-e9b0-c51a-80f65654c65b@fnarfbargle.com>

On Tue, Nov 17, 2020 at 08:58:47PM +1100, Brad Campbell wrote:
> On 17/11/20 6:24 pm, Dan Carpenter wrote:
> > This test is reversed so the function will return without sending
> > the APPLESMC_READ_CMD or completing the rest of the function.
> 
> That is as designed. The routine looks at the busy line and if it's
> already in the right state then it simply ends. If not then it tries
> to "re-align" the state machine by sending a new command.

Ah.  Ok.  It looked like a typo.  These "if (!ret) return ret;" typos
are surprisingly common so I review them every time they are added.
It's a static analysis warning, that I haven't published.  I kind of
feel like it would be more clearly intentional if it were written like
so:

	ret = wait_status(0, SMC_STATUS_BUSY);
	if (!ret)
		return 0;

But I try not to get too bogged down with style so let's leave it.

regards,
dan carpenter


  reply	other threads:[~2020-11-17 14:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17  7:24 [PATCH] hwmon: (applesmc) Fix smc_sane() function Dan Carpenter
2020-11-17  7:24 ` Dan Carpenter
2020-11-17  9:25 ` Brad Campbell
2020-11-17  9:25   ` Brad Campbell
2020-11-17  9:58 ` Brad Campbell
2020-11-17  9:58   ` Brad Campbell
2020-11-17 14:02   ` Dan Carpenter [this message]
2020-11-17 14:02     ` Dan Carpenter

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=20201117140259.GG18329@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=brad@fnarfbargle.com \
    --cc=jdelvare@suse.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rydberg@bitmath.org \
    /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.