Received: by 2002:ac0:cd04:0:0:0:0:0 with SMTP id w4csp75567imn; Fri, 1 Jul 2022 10:13:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sKhqi75uzcfXM0rDtHsNIxz88LuLjPqbwVwhQSI7oaoMxvpub2K/2YHZ/1clAZChbRJXYo X-Received: by 2002:a17:90a:9401:b0:1ee:e31f:7523 with SMTP id r1-20020a17090a940100b001eee31f7523mr17336423pjo.175.1656695610053; Fri, 01 Jul 2022 10:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656695610; cv=none; d=google.com; s=arc-20160816; b=RD9MpFSiWsh5VBmIaKxfdMwsDiKAmK2tnGJfRXu0s1Vko1sjeDwD4Tuwy4kGGD5wB9 izHFZg+/JIvi4yAOe4fkK5n3yyP+mPxEdxNHOgF/R97RXVEBzJpiMKMdk6+TIZ+CZPWh jsCebcuwAX6CQKepn8KXDZ3SZQpgOWoiP92EI2o87AnolWB6VMw+olv/YLQMYoXjLecG UP4PKCsNQyuN4hUJ190728P1glb+aGdfF5r0SE6+MQ79ZhX3t1nig4cd0XIYNKkKaQVG 0x35W4/gbChSCsV+nOoMI6gd96kMLeWM4GQfv86fR2ifzs1iIQRSYbPlZdnbiZBE2/Pi g85A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=mty5me6ttD4hyNm+ObIqVF8504n78lHkOkvX07KswbI=; b=xBrhlnNJP78ozn3/ISQ6vLabNXv31OGS0t8K3wDyJ4Zeh1L0tQwC+WgGqoyV1RuFNi tHjCzk5nBQt3vR67hpP9sp+YtRB92+AUD6UgUTgT33R+Ksc47zAtq+rMEATI+UhJeuQg lEnoTCOWQKlE84HIzkEdQKKDPfGmeZeQ8ilG0KYn3spz2rc2o7uSjD9v6H1vKJygtHSb cK+We0Hlv4Llcy7BVGx6apXmkdQzpMdCtj+qnTLfqlvamVLaGBsfxa5/Nv/vBupH6tni 9ifGjHSLWfIGxikuYCVIcZdKOFRUbcA3hce2s0L0OB7gnayNso+WnFeMKg7Cy4qSXPYh 3CUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=APAgpxiM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n6-20020a632706000000b0040986ef0885si10414446pgn.759.2022.07.01.10.13.06; Fri, 01 Jul 2022 10:13:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=APAgpxiM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231343AbiGAQtl (ORCPT + 99 others); Fri, 1 Jul 2022 12:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbiGAQtl (ORCPT ); Fri, 1 Jul 2022 12:49:41 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0D7A2A41D for ; Fri, 1 Jul 2022 09:49:39 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id k15so2811348iok.5 for ; Fri, 01 Jul 2022 09:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mty5me6ttD4hyNm+ObIqVF8504n78lHkOkvX07KswbI=; b=APAgpxiMHpOH07dyaKBPZJJvZsHU+HAs7siNihWvOzQ8g7N2h0GtoNLaPc1sxgHbU5 2lptTWDRtJ0Y1zqZwQ94ksL8yiGYPKCd3DKEs19dWavHuS0Ol7lJvI4qBc1MMvzkmMUq +FT/iZVAHO44b0ZGCbjArT3BoNJQji0fO16Ww= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mty5me6ttD4hyNm+ObIqVF8504n78lHkOkvX07KswbI=; b=RFRgRUBaZLJfHmOMxpgORMTVV5RLXuRTPlPbHljw28JR6NdDsOYtwFDZQuGCVythCS 4HPU45OviBAj9e8YDjJOQ2Es7AjCnOGcV3/nu/9ljBP2sw3VrVsYCtI0gY7z/QF+bRkn KRbVGDAhp3CygNtJlS05rxyrwNLUREWVMTHF2SOmzpEhuVLc/zzg/crMWeL7CWHPFBwh WWQYxdr+wyiWpl836jMdhPDo0AN/yJ1qNHBJoGBYJcYL1OnJd8JGfFrMzJw7HtvRwnEh CiDYCZ0uhVHUtNgYpQykE1fjiqCvrJL5v+aq/wBoILMT+VPFwXmpa8tHvCLJuTdVsj5l CLwA== X-Gm-Message-State: AJIora/0W8IXqXM1P5T1AufQUt90lapYxkXPgGYiQBXcgvHjgIDvMw9f M+ONlcmGX8V7oP2j0GKsX1NuVCYDfumqkg== X-Received: by 2002:a6b:8b42:0:b0:675:1e6d:9386 with SMTP id n63-20020a6b8b42000000b006751e6d9386mr8192474iod.153.1656694179105; Fri, 01 Jul 2022 09:49:39 -0700 (PDT) Received: from shuah-tx13.internal ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id u2-20020a02b1c2000000b00339df77c491sm9830281jah.114.2022.07.01.09.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 09:49:38 -0700 (PDT) From: Shuah Khan To: --to=arnd@arndb.de, gregkh@linuxfoundation.org Cc: Shuah Khan , linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH] misc: rtsx_usb: set return value in rsp_buf alloc err path Date: Fri, 1 Jul 2022 10:49:29 -0600 Message-Id: <20220701164929.15296-1-skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Fixes: 3776c7855985 ("misc: rtsx_usb: use separate command and response buffers") Signed-off-by: Shuah Khan --- 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