From: Shuah Khan <skhan@linuxfoundation.org>
To: --to=arnd@arndb.de, gregkh@linuxfoundation.org
Cc: Shuah Khan <skhan@linuxfoundation.org>,
linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: [PATCH] misc: rtsx_usb: set return value in rsp_buf alloc err path
Date: Fri, 1 Jul 2022 10:49:29 -0600 [thread overview]
Message-ID: <20220701164929.15296-1-skhan@linuxfoundation.org> (raw)
Set return value in rsp_buf alloc error path before going to
error handling.
drivers/misc/cardreader/rtsx_usb.c:639:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!ucr->rsp_buf)
^~~~~~~~~~~~~
drivers/misc/cardreader/rtsx_usb.c:678:9: note: uninitialized use occurs here
return ret;
^~~
drivers/misc/cardreader/rtsx_usb.c:639:2: note: remove the 'if' if its condition is always false
if (!ucr->rsp_buf)
^~~~~~~~~~~~~~~~~~
drivers/misc/cardreader/rtsx_usb.c:622:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 3776c7855985 ("misc: rtsx_usb: use separate command and response buffers")
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
drivers/misc/cardreader/rtsx_usb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/cardreader/rtsx_usb.c b/drivers/misc/cardreader/rtsx_usb.c
index 4e2108052509..f150d8769f19 100644
--- a/drivers/misc/cardreader/rtsx_usb.c
+++ b/drivers/misc/cardreader/rtsx_usb.c
@@ -636,8 +636,10 @@ static int rtsx_usb_probe(struct usb_interface *intf,
return -ENOMEM;
ucr->rsp_buf = kmalloc(IOBUF_SIZE, GFP_KERNEL);
- if (!ucr->rsp_buf)
+ if (!ucr->rsp_buf) {
+ ret = -ENOMEM;
goto out_free_cmd_buf;
+ }
usb_set_intfdata(intf, ucr);
--
2.34.1
reply other threads:[~2022-07-01 16:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220701164929.15296-1-skhan@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=--to=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.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
all inboxes | Powered by JetHome®