From: Maximilian Luz <luzmaximilian@gmail.com>
To: Zou Wei <zou_wei@huawei.com>,
hdegoede@redhat.com, mgross@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org,
Benjamin Tissoires <benjamin.tissoires@redhat.com>
Subject: Re: [PATCH -next] platform/surface: remove status assignment without reading
Date: Thu, 29 Oct 2020 14:05:31 +0100 [thread overview]
Message-ID: <25642c19-6598-42c0-36ad-a2b2d507183a@gmail.com> (raw)
In-Reply-To: <1603972048-64271-1-git-send-email-zou_wei@huawei.com>
On 10/29/20 12:47 PM, Zou Wei wrote:
> The status local variable is assigned but never read:
[...]
> static int s3_wmi_query_block(const char *guid, int instance, int *ret)
> {
> struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
> - acpi_status status;
> union acpi_object *obj;
> int error = 0;
>
> mutex_lock(&s3_wmi_lock);
> - status = wmi_query_block(guid, instance, &output);
I assume you want to remove the "status =" and not the whole line...
Regardless, I personally would prefer explicit error handling (as is
done in other contexts with wmi_query_block(), see e.g.
platform/x86/intel-wmi-sbl-fw-update.c. Although, yes, the "if (!obj |
..." should cover the error case as far as I can tell.
Also there seems to be the same issue in platform/x86/msi-wmi.c.
On a related note:
Does anyone know if the mutex here is really required? If there are any
problems, I believe it should rather go to s3_wmi_send_lid_state() and
also wrap the input_report_switch() / input_sync(). Otherwise, if there
were any race-type situations, not covering that could lead to wrong
updates:
Thread 1 Thread 2
s3_query_lid() returns old
s3_query_lid() returns new
input_report_switch()
input_sync()
input_report_switch()
input_sync()
I don't really expect those situations here as s3_wmi_send_lid_state()
is only used in probe(), resume(), and notify() (please correct me if
I'm wrong), so the mutex does seem weird to me here.
Otherwise if it's needed, a comment explaining why wouldn't hurt.
Regards,
Max
prev parent reply other threads:[~2020-10-29 13:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-29 11:47 [PATCH -next] platform/surface: remove status assignment without reading Zou Wei
2020-10-29 11:52 ` Andy Shevchenko
2020-10-29 13:05 ` Maximilian Luz [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=25642c19-6598-42c0-36ad-a2b2d507183a@gmail.com \
--to=luzmaximilian@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=zou_wei@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox