From: Yang Li <yang.lee@linux.alibaba.com>
To: arnd@arndb.de
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
Yang Li <yang.lee@linux.alibaba.com>
Subject: [PATCH] misc: rtsx: check the value returned from a function for errors before being used
Date: Wed, 24 Mar 2021 18:05:58 +0800 [thread overview]
Message-ID: <1616580358-93156-1-git-send-email-yang.lee@linux.alibaba.com> (raw)
Add missing return value check in pm_runtime_get disabling the
sensor. The issue is reported by coverity with the following error:
Medium:Unchecked return value(CHECKED_RETURN)
CWE252: Value returned from a function is not checked for errors before
being used.
Calling "pm_runtime_get" without checking return value.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
drivers/misc/cardreader/rtsx_pcr.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
index 2733111..2cc37fd 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -142,13 +142,16 @@ static void rtsx_pm_full_on(struct rtsx_pcr *pcr)
void rtsx_pci_start_run(struct rtsx_pcr *pcr)
{
+ int status;
/* If pci device removed, don't queue idle work any more */
if (pcr->remove_pci)
return;
if (pcr->rtd3_en)
if (pcr->is_runtime_suspended) {
- pm_runtime_get(&(pcr->pci->dev));
+ status = pm_runtime_get(&(pcr->pci->dev));
+ if (status < 0 && status != -EINPROGRESS)
+ pm_runtime_put_noidle(&(pcr->pci->dev));
pcr->is_runtime_suspended = false;
}
--
1.8.3.1
next reply other threads:[~2021-03-24 10:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 10:05 Yang Li [this message]
2021-03-24 10:17 ` [PATCH] misc: rtsx: check the value returned from a function for errors before being used Greg KH
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=1616580358-93156-1-git-send-email-yang.lee@linux.alibaba.com \
--to=yang.lee@linux.alibaba.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).