From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mario Limonciello <mario.limonciello@dell.com>
Cc: Darren Hart <dvhart@infradead.org>,
Andy Shevchenko <andy@infradead.org>,
platform-driver-x86@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] platform/x86: dell-smbios-wmi: Unlock on error in dell_smbios_wmi_call()
Date: Mon, 13 Nov 2017 10:05:55 +0000 [thread overview]
Message-ID: <20171113100555.sbn32ls22snpfgpg@mwanda> (raw)
We have to unlock before returning if get_first_smbios_priv() fails.
Fixes: 1a258e670434 ("platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/platform/x86/dell-smbios-wmi.c b/drivers/platform/x86/dell-smbios-wmi.c
index 35c13815b24c..7b0e3ca74ca0 100644
--- a/drivers/platform/x86/dell-smbios-wmi.c
+++ b/drivers/platform/x86/dell-smbios-wmi.c
@@ -91,8 +91,10 @@ int dell_smbios_wmi_call(struct calling_interface_buffer *buffer)
mutex_lock(&call_mutex);
priv = get_first_smbios_priv();
- if (!priv)
- return -ENODEV;
+ if (!priv) {
+ ret = -ENODEV;
+ goto unlock;
+ }
size = sizeof(struct calling_interface_buffer);
difference = priv->req_buf_size - sizeof(u64) - size;
@@ -101,6 +103,7 @@ int dell_smbios_wmi_call(struct calling_interface_buffer *buffer)
memcpy(&priv->buf->std, buffer, size);
ret = run_smbios_call(priv->wdev);
memcpy(buffer, &priv->buf->std, size);
+unlock:
mutex_unlock(&call_mutex);
return ret;
next reply other threads:[~2017-11-13 10:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-13 10:05 Dan Carpenter [this message]
2017-11-13 14:52 ` [PATCH] platform/x86: dell-smbios-wmi: Unlock on error in dell_smbios_wmi_call() Mario.Limonciello
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=20171113100555.sbn32ls22snpfgpg@mwanda \
--to=dan.carpenter@oracle.com \
--cc=andy@infradead.org \
--cc=dvhart@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=mario.limonciello@dell.com \
--cc=platform-driver-x86@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox