Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1060590rwo; Wed, 2 Aug 2023 08:10:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlHF9eBlNJ0RhYu2s4iVNLruIhqWYZmap8c5SQEj/x/Gn99ApSvfKXajMc4N+5X/ushA0Kl/ X-Received: by 2002:a17:90b:4a91:b0:263:f521:da3e with SMTP id lp17-20020a17090b4a9100b00263f521da3emr19610705pjb.2.1690989047141; Wed, 02 Aug 2023 08:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690989047; cv=none; d=google.com; s=arc-20160816; b=fSFAi/vRoKehKSZc2+TdYaNOp/y4GxycXi/1HS4YsajAqJhedAusqWEGOvEo5fcFBS Rhcp415dD4WmAKUTJtpUAtYmmfObNPCIr5xxzdtmLAuz43vhn5TOhb6q4q9hrSNYviOI U1PJZ7G8ATStRSb8iLuFe6lwYVRIQzcTfv2Qb4UQK8t9tepbPyQjkZM69JyJwRpcZbqm TGsZnE2w6bTZ/M9MK83SgRg5S/moTHUloIHmhiNuP7DBGBGzsAgia79KVmJ2vpEk5Jva lUGSjwzL47CFjo7zKVbJhFbfotuB+Mbrl4eMCl+cCMKiyMFNrmonKOq+lmISU2xcTThd OaTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=O/2WIVROlZsV9PaE7ZRV5iugvs6edZ71omTT4F/SSvo=; fh=Wm3Ki15EDU9niUqByhkXo9tZ3KlWbx+sm1wqi3LZEWw=; b=DJ+Yt2c9npa5ITX52llggtqxdQpcfwmRTEIjFu9ENQ/iYxnW1wWIHYvxBqA124WRuj 1CpCQN8RhXJOCcTUzcJCLx87Eet80fBuVFhjN3IBCbZ2zWhTIbOgiUSJNOLLdex7Joyw EzGUhcponv6eUKV01ZDR0LMoYh8lAytz1u/LobORkGFdo5P23iURVXGZyEpH1nPMu0z/ by8MIrL7trfwxI+8/QCOz/j5UEx0Ne4Jn4lLRD+7FZNXINux2XYBjNYeJvob7Pwh8gnG 3EK/NeZL+ituVcJ6Yl1RKA5ZbyzdAscxfEz2V0hkMBDn8zFoNlqBSUcxOYUervsWfxcX LYHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b5ttnfL5; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gj18-20020a17090b109200b002682b173a2fsi1381553pjb.148.2023.08.02.08.10.34; Wed, 02 Aug 2023 08:10:47 -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=@linaro.org header.s=google header.b=b5ttnfL5; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234056AbjHBNTe (ORCPT + 99 others); Wed, 2 Aug 2023 09:19:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234018AbjHBNTa (ORCPT ); Wed, 2 Aug 2023 09:19:30 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CCCE1724 for ; Wed, 2 Aug 2023 06:19:29 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fe1a17f983so35233125e9.3 for ; Wed, 02 Aug 2023 06:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690982367; x=1691587167; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=O/2WIVROlZsV9PaE7ZRV5iugvs6edZ71omTT4F/SSvo=; b=b5ttnfL5oEhNHJ+OuMs3TaY01QRb+YOyogeni8rOKLZRF34u4K7seXIEgc9zybGmDy i6CL1VdjafelnmnuFFrUfjUn2XCMDV0Dn0c/CIQ9VnH35f0a/AmkWcnQFD931P2VnAvi ppn66jIET8cdYTFhWERY2AFPKxopY+IyxBsAoKoVMSGyYaEEJ8wLYHFH0qM/WdDzm75M DzRsx+xyBo/RoEwtmvScNiwcPUmZqmpPSfsQ8SI1HOKOfgCjojPjI/zbXUF++XjXeVIu Hc7uLzGLqp0iKRBZg5lmWkB4q5qcyV1ZRNIRmrHJzWBF5GaE84d3dQLZxFnfxu2x7ca0 6FBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690982367; x=1691587167; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O/2WIVROlZsV9PaE7ZRV5iugvs6edZ71omTT4F/SSvo=; b=BqDNIY5vbYwiGVJQrgowAEYyirnEBvCe8Ah2f7yM0OHzwU28UqP9CI45vu3/0S9UJP I0YCOO3XsobyfnCDiz89m8FZ0oszDmiq0YMMRGbX93FhoUitcRTU+3UeqnHuKDuN6oS8 n/Orw6beMlGyuy/VBkLD9k23yzv1tzdrqlMKC9yJbto8W5JuHrr2r1j0AOj2c+OJg/gy hKsqxMuAFN6EqvWCqRqGWX1rr1n76BftwIIVp4RGI1Tke2HduVPEGWtAoOw/YlRrfbMl hMAODcUTIPOdfpC+CHIrbFqmZzrCHpOgZyR21H3MvO0neLv4//FJAe2gUsaXs/XwUeyR KZVA== X-Gm-Message-State: ABy/qLbJtOG40akg/biWX/uKZUIBbcC7BS5nb/imS4JZaMik/x08uyB9 X0hYmYTMIFYHAyOLwjVHwdBFyQ== X-Received: by 2002:adf:f44c:0:b0:317:3f64:4901 with SMTP id f12-20020adff44c000000b003173f644901mr4651149wrp.41.1690982367568; Wed, 02 Aug 2023 06:19:27 -0700 (PDT) Received: from [192.168.1.14] (host-92-17-103-66.as13285.net. [92.17.103.66]) by smtp.gmail.com with ESMTPSA id d14-20020adff2ce000000b003176053506fsm15276105wrp.99.2023.08.02.06.19.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Aug 2023 06:19:27 -0700 (PDT) Message-ID: <2c0860e2-40d6-ec91-60cf-2684edd52676@linaro.org> Date: Wed, 2 Aug 2023 14:19:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: drivers/power/supply/qcom_pmi8998_charger.c:565 smb2_status_change_work() error: uninitialized symbol 'usb_online'. Content-Language: en-US To: kernel test robot , oe-kbuild@lists.linux.dev Cc: lkp@intel.com, Dan Carpenter , oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Sebastian Reichel , Harshit Mogalapalli References: From: Caleb Connolly In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 28/07/2023 06:45, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: 57012c57536f8814dec92e74197ee96c3498d24e > commit: 8648aeb5d7b70e13264ff5f444f22081d37d4670 power: supply: add Qualcomm PMI8998 SMB2 Charger driver > config: arm-randconfig-m041-20230727 (https://download.01.org/0day-ci/archive/20230728/202307280638.556PrzIS-lkp@intel.com/config) > compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0 > reproduce: (https://download.01.org/0day-ci/archive/20230728/202307280638.556PrzIS-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > | Reported-by: Dan Carpenter > | Closes: https://lore.kernel.org/r/202307280638.556PrzIS-lkp@intel.com/ > > smatch warnings: > drivers/power/supply/qcom_pmi8998_charger.c:565 smb2_status_change_work() error: uninitialized symbol 'usb_online'. Hi, thanks for the report. > > vim +/usb_online +565 drivers/power/supply/qcom_pmi8998_charger.c > > 8648aeb5d7b70e Caleb Connolly 2023-05-26 556 static void smb2_status_change_work(struct work_struct *work) > 8648aeb5d7b70e Caleb Connolly 2023-05-26 557 { > 8648aeb5d7b70e Caleb Connolly 2023-05-26 558 unsigned int charger_type, current_ua; > 8648aeb5d7b70e Caleb Connolly 2023-05-26 559 int usb_online, count, rc; > 8648aeb5d7b70e Caleb Connolly 2023-05-26 560 struct smb2_chip *chip; > 8648aeb5d7b70e Caleb Connolly 2023-05-26 561 > 8648aeb5d7b70e Caleb Connolly 2023-05-26 562 chip = container_of(work, struct smb2_chip, status_change_work.work); > 8648aeb5d7b70e Caleb Connolly 2023-05-26 563 > 8648aeb5d7b70e Caleb Connolly 2023-05-26 564 smb2_get_prop_usb_online(chip, &usb_online); > > This can only happen if regmap_read() fails, and in real life they > can't actually fail can they? We can't really recover if regmap > breaks so in that situation this uninitialized variable would be the > least of our concerns. Right? In this case, the driver is for a peripheral on the SPMI bus, a read failing is extremely unlikely but under some conditions like bandwidth constraints it could happen. Though admittedly there are likely bigger issues to deal with in that situation heh. It's a trivial fix so I'll send a patch over. > > So what I could do is just delete the regmap_read error paths from > the DB. I just add these two lines to smatch_data/db/kernel.delete.return_states > > regmap_read (-22) > regmap_read (-4095)-(-1) > > 8648aeb5d7b70e Caleb Connolly 2023-05-26 @565 if (!usb_online) > ^^^^^^^^^^ > > 8648aeb5d7b70e Caleb Connolly 2023-05-26 566 return; > 8648aeb5d7b70e Caleb Connolly 2023-05-26 567 > 8648aeb5d7b70e Caleb Connolly 2023-05-26 568 for (count = 0; count < 3; count++) { > 8648aeb5d7b70e Caleb Connolly 2023-05-26 569 dev_dbg(chip->dev, "get charger type retry %d\n", count); > -- // Caleb (they/them)