Skip to content

Commit 2cd37c2

Browse files
shuahkhgregkh
authored andcommitted
misc: rtsx_usb: set return value in rsp_buf alloc err path
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 Fixes: 3776c78 ("misc: rtsx_usb: use separate command and response buffers") Reported-by: kernel test robot <lkp@intel.com> Cc: stable <stable@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Link: https://lore.kernel.org/r/20220701165352.15687-1-skhan@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3776c78 commit 2cd37c2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/misc/cardreader/rtsx_usb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,10 @@ static int rtsx_usb_probe(struct usb_interface *intf,
636636
return -ENOMEM;
637637

638638
ucr->rsp_buf = kmalloc(IOBUF_SIZE, GFP_KERNEL);
639-
if (!ucr->rsp_buf)
639+
if (!ucr->rsp_buf) {
640+
ret = -ENOMEM;
640641
goto out_free_cmd_buf;
642+
}
641643

642644
usb_set_intfdata(intf, ucr);
643645

0 commit comments

Comments
 (0)