From patchwork Thu Aug 19 18:09:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 499758 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp772606jab; Thu, 19 Aug 2021 11:09:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOCOzl7khvyvuaSc6pyD4YRHnOLoE1AqbWC8GcBeyVzDzGUj/fp8VrToQMYztpiN1vypPQ X-Received: by 2002:a5e:a81a:: with SMTP id c26mr12505628ioa.15.1629396591842; Thu, 19 Aug 2021 11:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629396591; cv=none; d=google.com; s=arc-20160816; b=DQ2jNQJVUrDOSbTvnzh8Zum7dJCxaaj0J0SPXn1sF4kcoxjnQhs5KKurc1qSe8dAl4 XyuZ13lPyfr6WLlMORgts7qchYTTcYF3NexDoUiFBMZ0tDPCwcliP4Gh+TcvvR0Wy4Ez kK2WW3P3uotpfPSwhomK7bdfK9CNaAy/TAk5wB5XJLdEWlRyyX5EsuNG2Oq1ZJBuY4OG MWxjRN8QeiBmnO4TrKEldfnCyNpae2mod5YKIhLd2MvHTknAP34m2n/bgBpZQBKidbIb ILUVQKb6rLOAitnVAjnwuKZyBfgsgVA0lb5f7W3Ws18rTxeiip3kZd8Nn40UjyvFoZWA 1+Ig== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JmCDVcDPr5bxst7uNZbmQzVkDOfalyIwULzIMEWLkMY=; b=D2xCewA4r7GkWu/8QYvS8fmyZbUOGJ762RPa7opCtUbYld/DkJK08zIfJxC7LuKApK Z6LqACt/8SX7BDzJSNC2aYp37nIPjSIVtUhjiNhDyH1n8oll5X8Ftj1J+9h5s2OjOqvn CGF5geITLqhiNv8GkShq+LzHEMhooXX77oIiv/EgxufHP6R3YVHBl3HBgtxRUOzjCWm6 1q7hLkoCW4HEwQyAi8lC6yISWsjWP+skVvjAtOa1d5OskQQc0CfzjibIm12Z8QsMcI2x 4EbFcMIvpkx24V8AKrv2etBkW91BDfWE3M57zcy4kAFhqlHBhOlzzhi83ZU9ISI66GT0 SM5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ThyHI7NG; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si3606755ioe.21.2021.08.19.11.09.51; Thu, 19 Aug 2021 11:09:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ThyHI7NG; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-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 S234244AbhHSSK1 (ORCPT + 4 others); Thu, 19 Aug 2021 14:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbhHSSK0 (ORCPT ); Thu, 19 Aug 2021 14:10:26 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5873EC061575 for ; Thu, 19 Aug 2021 11:09:50 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id v20-20020a1cf714000000b002e71f4d2026so30326wmh.1 for ; Thu, 19 Aug 2021 11:09:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JmCDVcDPr5bxst7uNZbmQzVkDOfalyIwULzIMEWLkMY=; b=ThyHI7NGLfwsYBdsiEWavAFR269WKTFwFqw+dbgueZdpT0ho/GVW3YLIa0azxxZCt2 WohB25kgegHe0H8VfBtf2B9Vh+27zelFFTLboiOdqXLUZCWdOLah+8dy04Sre3lcDXT6 ZpU210DMxTCtZG8xIjWd30HC0c+vcIiJeQeppglCPfJZG5xHSUtoilMBUQOVuYY+LDP3 n9KKs99OX2h6L61kvl78J/5Yi1ZC75SSKEuWaD3mzMM77I5trd8wvlzdWrUqjNP0Nu8N RcqhOF4USqWplqZ+f2jjohZeoubnxp5LDj2zMpETV/OQsBxPWj7umwhp+/Gw2Z0IV9uj bw6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JmCDVcDPr5bxst7uNZbmQzVkDOfalyIwULzIMEWLkMY=; b=pQ/C99QpuQNZPedbDClINsmSSx2b7Rocw1BfMOGdZJjLb2leWNbRvuKr6ZcuLHqn8d fq/KB2Mbgdlb7FCxXs3hx8u4DFZUPIOiNasIZsLa5jCYmJhHLkMsrJ/U2OYj3cozJL2H Syd7D/EI0/B2TS9YrGO0xxearkEn3r4jt74Du0fq/v3mWXbbXRIHhgnLt6S0/BcUgcfN cFq63Z6N1wpAbuyhF/OVroQ3G4zMrrzSetIncQnLXQCXVA9AJWVX7VOXp3nSdpXJ6Yay VaP7IAIHnvIqQjFoodd6rTyjSyVApVuLYCTqeMTnHnwxv9vyrTDFkUIPs4Zh8CTluvB2 soqw== X-Gm-Message-State: AOAM533A3n2Gbi4IoNDxcfkagFGWmERVpoiwxVGXgreX8vTO85RcriLy 1XWcMwgZW8h3+E1RKuKE3Xo3PQ== X-Received: by 2002:a1c:3909:: with SMTP id g9mr14794276wma.63.1629396589009; Thu, 19 Aug 2021 11:09:49 -0700 (PDT) Received: from arch-thunder.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id h16sm3625668wre.52.2021.08.19.11.09.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 11:09:48 -0700 (PDT) From: Rui Miguel Silva To: Greg Kroah-Hartman , Alan Stern Cc: linux-usb@vger.kernel.org, Rui Miguel Silva Subject: [PATCH 1/5] usb: isp1760: ignore return value for bus change pattern Date: Thu, 19 Aug 2021 19:09:25 +0100 Message-Id: <20210819180929.1327349-2-rui.silva@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210819180929.1327349-1-rui.silva@linaro.org> References: <20210819180929.1327349-1-rui.silva@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org We do not care about the return value of that read between the scratch register write and read, we really just want to make sure that the pattern in the bus get changed to make sure we are testing correctly the scratch pattern. Clang-analyzer complains about the never read scratch variable: >> drivers/usb/isp1760/isp1760-hcd.c:735:2: warning: Value stored to 'scratch' is never read [clang-analyzer-deadcode.DeadStores] scratch = isp1760_hcd_read(hcd, HC_CHIP_ID_HIGH); Just ignore the return value of that CHIP_ID_HIGH read, add more information to the comment above why we are doing this. And as at it, just do a small format change in the error message bellow. Signed-off-by: Rui Miguel Silva --- drivers/usb/isp1760/isp1760-hcd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.33.0 diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index 825be736be33..2a21fe5aa7a8 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -731,11 +731,15 @@ static int isp1760_hc_setup(struct usb_hcd *hcd) isp1760_hcd_write(hcd, HC_SCRATCH, pattern); - /* Change bus pattern */ - scratch = isp1760_hcd_read(hcd, HC_CHIP_ID_HIGH); + /* + * we do not care about the read value here we just want to + * change bus pattern. + */ + isp1760_hcd_read(hcd, HC_CHIP_ID_HIGH); scratch = isp1760_hcd_read(hcd, HC_SCRATCH); if (scratch != pattern) { - dev_err(hcd->self.controller, "Scratch test failed. 0x%08x\n", scratch); + dev_err(hcd->self.controller, "Scratch test failed. 0x%08x\n", + scratch); return -ENODEV; } From patchwork Thu Aug 19 18:09:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 499759 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp772638jab; Thu, 19 Aug 2021 11:09:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBJMR3Vqtz5Ou0Iq57/cTnvOBlY3l24riMw47FgJmnptqRMA/ye1ZUl26QVsG8auZKdMGm X-Received: by 2002:a02:908a:: with SMTP id x10mr13691450jaf.30.1629396594135; Thu, 19 Aug 2021 11:09:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629396594; cv=none; d=google.com; s=arc-20160816; b=N319TCZWWaOB1iDQ9xVoNPEYQ1uttX5z6EVZdnGst1QljmtsGldIJysO/yNwNlJ/dQ /zvYt7ALRilelNo4jVQYRR32h39nErkglO9Y1z83RuYZsdFrolpyKTVqQQFWv5GpiAIV DjRumUQl+SWUm5Dnsq5Ed/1LckF/dd/LLwMQLcA3qm3imYHHn2ByLevXVSP22FRvuAVR FyOrSrEOZ1u1qEBo40PBGsoLnSE3cx0juWmk+AnmQoMj0FAr85Vi1fvH/N/el+y2GTkN 55njjJekVTG4IIZW3OcybNbMpfAmunDogJY3EWfPTNka7flB7O3solP4ULYQfhkD3FnV RYrw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nJFsB0vNTcvxAccxAs8X/3nZKeh6jAZ98Q3ZjWO+LEQ=; b=V+xwC1wHekRb3YOXzU+XXiuez1D7r/yycxgx6NK2fb0YUc8TBCxaXnpXIND3t+hiKu BU/qDTWCKvt0voCQZ32MTgmjz7+DePY+gcfzS0m+BjOfsT7MgxakXudhPVstETKrEs8b WiHeqFNXdLDOICoX0QS1PjKFCyUazhuo7v44TrrGWcyd+v+QSHunv8JMcwNdu8yJaJld ftizqoAjtKupfAnL8FQpVxvs6Jlzloy9yivi+jrkA/G+RvSI5Bo4YjIm3r0W/EC2EtBp SDA0j99c4jE0DTxlBaw/ZYW6C4AmD0NDn4HYuCV/XSIbPc+QeSnczUGNIog/4qR0RMw3 +u6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wv1an5Vd; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si3606755ioe.21.2021.08.19.11.09.54; Thu, 19 Aug 2021 11:09:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wv1an5Vd; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-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 S234261AbhHSSK3 (ORCPT + 4 others); Thu, 19 Aug 2021 14:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234246AbhHSSK3 (ORCPT ); Thu, 19 Aug 2021 14:10:29 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 921C6C061575 for ; Thu, 19 Aug 2021 11:09:52 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id f13-20020a1c6a0d000000b002e6fd0b0b3fso5754651wmc.3 for ; Thu, 19 Aug 2021 11:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nJFsB0vNTcvxAccxAs8X/3nZKeh6jAZ98Q3ZjWO+LEQ=; b=Wv1an5VdNrbgraw7EX4H4zOhAWUPNg2I0JM/753YIzCbjA5Fx6Kn8wDX9L0cBzoKh7 S5UIdzHCbLSh7anQxjs6GFdS357toSGUTNdnkKtneCQk3+XSV1/gOTSL9IDzzNRR0PRN eLYOj7pHYzFoKVUJKyvy3+rXMHhFItIDPqT+7fnRqg/Xf6gVNVnlqUu6cJd4IK05bUE/ Gna/oPee5FUhDuYAQ2Zv8EejH9bnKsyWIvLJI93DaXnvURx/eWridh/8WuOY7cHNavhO vi1qI0oA9q29RKMTROdLeWNCbmV99y40fpwVTalsMFcDcn7y6QHNiofcQF1dE6NajH8+ +1sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nJFsB0vNTcvxAccxAs8X/3nZKeh6jAZ98Q3ZjWO+LEQ=; b=hMApu5e31ie1yHCyUNnJ2UA2j7ogxvylJMr/ly1//D3oaRapxxXAUe4atVQjAPK1E4 JZdNB7oXYJi/okhpSfhnIGlhVFuurKhlVwiCgT1Hpu/s/VMbtv2LMlp7cX5MzjoUzJYh Yu6cHcS3yiFJbHKiO/4F3RX+nSZ6ElcxVgSnon3pTy77KXZM4nafBeV6Qkp6dJwGqoQP csGI3fmKH8VxofZ6oU7R+ndLKu8e/9qhK3cjOOJ6uAa25zCZdDx86UMnl42JMGYUbdr6 wXzVMWUHhVJu6djyvQbDKsRZKd/zHEwxnT4irnBdRDjzhJj5qm+6kTh/LNbUko3Hl2Wo sp5Q== X-Gm-Message-State: AOAM532u47NZ+3LiUo2qMJkdMN/pFYgJnmPk11MKEy+12d8z6fh5cFbE /YzzApqrnMWTBwrCoLoTuzxO9w== X-Received: by 2002:a7b:cf0c:: with SMTP id l12mr25984wmg.62.1629396591112; Thu, 19 Aug 2021 11:09:51 -0700 (PDT) Received: from arch-thunder.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id h16sm3625668wre.52.2021.08.19.11.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 11:09:50 -0700 (PDT) From: Rui Miguel Silva To: Greg Kroah-Hartman , Alan Stern Cc: linux-usb@vger.kernel.org, Rui Miguel Silva Subject: [PATCH 2/5] usb: isp1760: check maxpacketsize before using it Date: Thu, 19 Aug 2021 19:09:26 +0100 Message-Id: <20210819180929.1327349-3-rui.silva@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210819180929.1327349-1-rui.silva@linaro.org> References: <20210819180929.1327349-1-rui.silva@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org When checking if we need one more packet on a bulk pipe we may, even though not probable at all, get there with a zero maxpacketsize. In that case for sure no packet, no even a one more, will be allocated. This will clean the clang-analyzer warning: drivers/usb/isp1760/isp1760-hcd.c:1856:38: warning: Division by zero [clang-analyzer-core.DivideZero] && !(urb->transfer_buffer_length % Signed-off-by: Rui Miguel Silva --- drivers/usb/isp1760/isp1760-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.33.0 diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index 2a21fe5aa7a8..5c947a1eae49 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -1854,7 +1854,7 @@ static void packetize_urb(struct usb_hcd *hcd, packet_type = OUT_PID; else packet_type = IN_PID; - } else if (usb_pipebulk(urb->pipe) + } else if (usb_pipebulk(urb->pipe) && maxpacketsize && (urb->transfer_flags & URB_ZERO_PACKET) && !(urb->transfer_buffer_length % maxpacketsize)) { From patchwork Thu Aug 19 18:09:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 499760 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp772686jab; Thu, 19 Aug 2021 11:09:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEopD/x35f6VyBF5j0viT/5vqtq4zSiIUDw/Mm5S1Si03ZOWtOWMpjqA7GI1bBsoxttAJF X-Received: by 2002:a02:1083:: with SMTP id 125mr13866836jay.34.1629396597865; Thu, 19 Aug 2021 11:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629396597; cv=none; d=google.com; s=arc-20160816; b=GCjRWf30TTNZaXX2fftfRTQGHB33jhtd3gU5aOm3oap9wivgEk/Dr0eK9xfIA41si2 1p+NLoz9o1G5B9EbZnQfxBee8a66PEL05q+bhQMHen+/Q+AtAHwL3qD8QX6rLyuUoZn2 K8QUXTkgc8h52ILRyvfN7GbVAmATj2FsPtgv9y1YUdS4bFnJYKtKM8vAUcpByFnJXR9T L2AneDnllwu6gH5v3IYpinkNHrGH4qDOAvI1X7kpSXw9rgX1Qox62/4Fu1wE9hpR36Y9 MsKaGNrYFhQbZBPCYCvAt5xSf5kwytQ4n3ZsijuNylPNy1OKIAHT3hyEEjpzg1I5wRN0 TiMQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kIhATUwU3sUQYA4q+gJG6oepV84++lZlrfSYVpZi/Vs=; b=QuuMDVWaTSSxvlqoojT30UHBNo4xyMrZdHZyl20TympTt7Gte85Lkl7/lDi8FKilp9 mzMqpUCrP09QKQxPCfqDmt5I1czifDJ16M6q0HEJx3lXVS7Pf57DP4P3OWLQ3IIRuWDu gDUcB6TOMKwi2ywLJbOc3CVPql9XrIzXORLsNiPQI0pJwbe818TlsQwHs9FIDUabY7Oz D0MOOzEcnri9j+yMeRSZk9N348hGD72A2Au/CljXQruuMI3s0sd7Ptel1hcOaFLS9AAi CczIYC/y47gvfMbbjHU8IQFKBoGZqBtB92lStcu99glhOUKUNUqeGqGHjuxyEahxPesj gM2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PLoEyfbF; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si3606755ioe.21.2021.08.19.11.09.57; Thu, 19 Aug 2021 11:09:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PLoEyfbF; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-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 S234280AbhHSSKb (ORCPT + 4 others); Thu, 19 Aug 2021 14:10:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbhHSSKa (ORCPT ); Thu, 19 Aug 2021 14:10:30 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46DECC061575 for ; Thu, 19 Aug 2021 11:09:54 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id g138so4344548wmg.4 for ; Thu, 19 Aug 2021 11:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kIhATUwU3sUQYA4q+gJG6oepV84++lZlrfSYVpZi/Vs=; b=PLoEyfbFNDueucBTSH5khGQEwCDcfGBRfIgUqzg14x8DgeVgU3k+CX+70c0MxLdFFE Y4Z6YDTWPrzIw65gTljM1rv+oTz00eGTmLWlA7pPrqxBdnlQsIEtVz0dB75JQRiCSNNP n7tfNmXz45GkVHP8ibapyqgcWoCQX5sBiKI8X4jm6sInMk5k0vzGsOtL7OVEmPa1zxNj cTQbOTJc7+27Ef+9WuRFk8XBIAQDoTqZ/7BSBBWVIsfnT7HX9I7TRcTURCg+SXtZFH4E q9C02z6EVunOf/Ai/tpugr513MlsF1OlNAOGj+D8sD5f9pjJndz1j+XSWuuJxfpHyrEX wg/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kIhATUwU3sUQYA4q+gJG6oepV84++lZlrfSYVpZi/Vs=; b=SYClS6kLCSQtxjOMVRUJGKH61hykvUQNWW4GeZfk5vw5XROHcHY0tQ2Ccpo5NwyKOg rVRcElQaDMlICRHktLD8ih0VV5t07Aea5w8H3vxMwqRC/nCJa3E1oK2TZWEv5Jtkt0qk 5wkQiNzeRxdO1NhcjkYuNFMPkTZb9SEEHpJ5LIrS+cmD0KSN2mZ2y9+Z6Lcf9g2570WX EsMPUSVxRp2RTTXLtX+VpwmBmOLBFqB7M9HgpCxwh0upLxzEUOqrK4fzIz5y/xN1GJHM /T/dlpjJd54hv9ApNRPqAeAnbfhLpObLxFt/rWEY5WrxsY7IkEeZBS0ae20PHyEEH1wd 1pKg== X-Gm-Message-State: AOAM531PT4BxZLu0lq/mMxlef5nBXWjtuPaWG5oWT6nBUTJvXPoPO/tA ohQPzz1nztX+SUp9vq6AR+7ozQ== X-Received: by 2002:a05:600c:3591:: with SMTP id p17mr15373wmq.134.1629396592911; Thu, 19 Aug 2021 11:09:52 -0700 (PDT) Received: from arch-thunder.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id h16sm3625668wre.52.2021.08.19.11.09.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 11:09:52 -0700 (PDT) From: Rui Miguel Silva To: Greg Kroah-Hartman , Alan Stern Cc: linux-usb@vger.kernel.org, Rui Miguel Silva Subject: [PATCH 3/5] usb: isp1760: do not reset retval Date: Thu, 19 Aug 2021 19:09:27 +0100 Message-Id: <20210819180929.1327349-4-rui.silva@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210819180929.1327349-1-rui.silva@linaro.org> References: <20210819180929.1327349-1-rui.silva@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org We do not really need to reset retval before get used bellow. This will avoid the clang-analyzer warning: drivers/usb/isp1760/isp1760-hcd.c:1919:2: warning: Value stored to 'retval' is never read [clang-analyzer-deadcode.DeadStores] retval = 0; Signed-off-by: Rui Miguel Silva --- drivers/usb/isp1760/isp1760-hcd.c | 1 - 1 file changed, 1 deletion(-) -- 2.33.0 diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index 5c947a1eae49..aed2714ce0cf 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -1919,7 +1919,6 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, if (list_empty(&new_qtds)) return -ENOMEM; - retval = 0; spin_lock_irqsave(&priv->lock, spinflags); if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { From patchwork Thu Aug 19 18:09:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 499761 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp772694jab; Thu, 19 Aug 2021 11:09:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqJXcwUbW4QZ+yaWizSuYuEwGpCQQ/lK0GjXJW6CCo51Xo+o87+IP1NcgEYWu0vjILiS7U X-Received: by 2002:a05:6e02:cc3:: with SMTP id c3mr10882440ilj.207.1629396598902; Thu, 19 Aug 2021 11:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629396598; cv=none; d=google.com; s=arc-20160816; b=X+shHq8GYgo4aZVMYDU/M4BwD/M9Rqgnc5ISkvZGPCQEyhrCCKUYzO0Q9lU0wpZC/5 /QPjzThtRjXq1gOLsrNPIv75lBjwGkntWGvUJU5/SDLujH4OhpYy5FcISax6ZTn5WpNg qq9N6Qqpt4jcBonscm4dTLy4zNeWD3wvvmJrX1Wm62jVgCMDe/mFKCOQEzyiAwDMC49B sMpum82H/vZEYFdxvn/MQ9JiKhfXbzkSCFBkj6/T3SfEFmM+AgfYbbTPc7i8vwWcrYs0 kJxhKoSZSO8RljA+yIBIyGJ0+v7FKeXS8g0/JmQSSy9xhPehTqeJB0XxNxz++tMiwflG EbLg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pMSofRuLOOEM7S4GLf+GNrXNSMWfOcGXM1C31TKENBk=; b=Pd0TmtrUO5S9BchjT9eCCyXgMXpvLqlkALy4nG4ScnUDqO/bD6zNdwasgkiuy2BRCB /3iZXCr5JCKH3UWde9vdAXViXhLmgCgz2GvKw+hzemAjU3BJLGIT5mnbBn3TJkP5wbaA bYrhdLf0JYyMNP5i9FHqOOW14nwgi1TBGmtCFYoiSf7tlY4rwLq2UL6Eyd0SbHNRpmX+ Ykfjn4EHb99qBl10/HEq/VvHg6UHgnanDR686punOyPh1T4aAvZ50DPqammkR5NVJlE7 3EHJQ4gyLplslENOa2QNElaJn5JlRN62RrTYhTuu7PGMBYGdHQFCm2So18/ZAW2tn2It rLNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=az+O+V4G; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si3606755ioe.21.2021.08.19.11.09.58; Thu, 19 Aug 2021 11:09:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=az+O+V4G; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-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 S234306AbhHSSKe (ORCPT + 4 others); Thu, 19 Aug 2021 14:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234246AbhHSSKc (ORCPT ); Thu, 19 Aug 2021 14:10:32 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECE09C061575 for ; Thu, 19 Aug 2021 11:09:55 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id q11so10378334wrr.9 for ; Thu, 19 Aug 2021 11:09:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pMSofRuLOOEM7S4GLf+GNrXNSMWfOcGXM1C31TKENBk=; b=az+O+V4GOiSZhHL7uvCPOkIyBa8xVmKZrl3tWgHLCmOjeqf6KknZHqU68B41Fhr2ur Ios8Ca0LKJRRSYNdfWN3Y0s8Ud5D5JRnAjkvIGH75LYDdPiGgBpWYsdG9e8Joi8K/T2N w8ZhQH48K+A0MBjdUxhfCasrSbp+Dgqge0U6zFZopi35HYr/P11eG6K21cSx02I7vqiF QNgJoDj9OXqufwi08TftkfJRnMc8yjbESRNiYh4ZVuvGo/CPVbABd9LZTdc+QP0tOTmq QOAzIj6oTiQq1I5443TENPhiR06jdVK6Y+nDMsa1IRIVjjhGfkzwcBfRHXFxMP2NBzIX UckA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pMSofRuLOOEM7S4GLf+GNrXNSMWfOcGXM1C31TKENBk=; b=j9IHTqqnTQyzwi4qQdPAM5gLOg8R5MsaS0BsWwJ+cjLDK64edEu452z8+TxJIFlfPy lYbAlu3+zIC3QSKKVEWpovqVwq8MsadpiCSH1w8U+HltfabZEt3NeDTWikbR98R+VmNZ pQWkIpm9vK37DfaghT+7bDybNG2PexLMqVVf+x8fpgJHi1M6sxyrVJvBc4scgNQbjI72 qjCHgrEvsS5CAfzMMlTreKuz7bPYmZgFDqCkjdZgOR1UR2N9/gb8ybmIUieGN4/hpZje yo5FgFCdq32utdxqvMiWEWOguJK1Bs0wBC1OdPpZ/bez9ub6Ty9XEzPo6oPX15FNPy6z pNRQ== X-Gm-Message-State: AOAM533HOVfBHQ9JS9shGqASd3j/En8vEgaSIEednFkXqgTwLfkVgFy4 rdCfNOYZORiFoYKwPhJQtQMutA== X-Received: by 2002:a5d:6301:: with SMTP id i1mr5271775wru.423.1629396594614; Thu, 19 Aug 2021 11:09:54 -0700 (PDT) Received: from arch-thunder.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id h16sm3625668wre.52.2021.08.19.11.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 11:09:54 -0700 (PDT) From: Rui Miguel Silva To: Greg Kroah-Hartman , Alan Stern Cc: linux-usb@vger.kernel.org, Rui Miguel Silva Subject: [PATCH 4/5] usb: isp1760: do not shift in uninitialized slot Date: Thu, 19 Aug 2021 19:09:28 +0100 Message-Id: <20210819180929.1327349-5-rui.silva@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210819180929.1327349-1-rui.silva@linaro.org> References: <20210819180929.1327349-1-rui.silva@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Even though it is not expected, and would trigger a WARN_ON, killing a transfer in a uninitialized slot this sequence is warned by clang analyzer, twice: drivers/usb/isp1760/isp1760-hcd.c:1976:18: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult] skip_map |= (1 << qh->slot); drivers/usb/isp1760/isp1760-hcd.c:1983:18: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult] skip_map |= (1 << qh->slot); Only set skip map if slot is active. Signed-off-by: Rui Miguel Silva --- drivers/usb/isp1760/isp1760-hcd.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) -- 2.33.0 diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index aed2714ce0cf..bf8ab3fe2e5a 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -1974,16 +1974,20 @@ static void kill_transfer(struct usb_hcd *hcd, struct urb *urb, /* We need to forcefully reclaim the slot since some transfers never return, e.g. interrupt transfers and NAKed bulk transfers. */ if (usb_pipecontrol(urb->pipe) || usb_pipebulk(urb->pipe)) { - skip_map = isp1760_hcd_read(hcd, HC_ATL_PTD_SKIPMAP); - skip_map |= (1 << qh->slot); - isp1760_hcd_write(hcd, HC_ATL_PTD_SKIPMAP, skip_map); - ndelay(100); + if (qh->slot != -1) { + skip_map = isp1760_hcd_read(hcd, HC_ATL_PTD_SKIPMAP); + skip_map |= (1 << qh->slot); + isp1760_hcd_write(hcd, HC_ATL_PTD_SKIPMAP, skip_map); + ndelay(100); + } priv->atl_slots[qh->slot].qh = NULL; priv->atl_slots[qh->slot].qtd = NULL; } else { - skip_map = isp1760_hcd_read(hcd, HC_INT_PTD_SKIPMAP); - skip_map |= (1 << qh->slot); - isp1760_hcd_write(hcd, HC_INT_PTD_SKIPMAP, skip_map); + if (qh->slot != -1) { + skip_map = isp1760_hcd_read(hcd, HC_INT_PTD_SKIPMAP); + skip_map |= (1 << qh->slot); + isp1760_hcd_write(hcd, HC_INT_PTD_SKIPMAP, skip_map); + } priv->int_slots[qh->slot].qh = NULL; priv->int_slots[qh->slot].qtd = NULL; } From patchwork Thu Aug 19 18:09:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 499762 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp772699jab; Thu, 19 Aug 2021 11:09:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5R6zZpOaPUmLcFJ7r7Xo3PPL34QmjRfjKUhjNtLr8Lch/fal0FQpW+LYRlu+A/NQxAsX4 X-Received: by 2002:a05:6638:2284:: with SMTP id y4mr14501104jas.75.1629396599217; Thu, 19 Aug 2021 11:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629396599; cv=none; d=google.com; s=arc-20160816; b=BHxrqSB8Ms0Uf3QNWJ+5ZlGXlw6VjoJUukpiga8n9xbaJh9ZpkfbERTnxF2kDtNw6T sIbYn1i6IYafgaZqy/FzzmHDIStESnxL6SAVXBZNbg3rRdvpgO5Kvc/Lohc3JC48Ea1l g/uXL7bnsknH8gwyjsRpQUIWZkFf+FRTkvnhflEfBqr3l3ZGd8QjDsQScVJI1eN7lnrl kjaSfGnhzd97eZmIIrDeLzvXPbE8uyJHmqY5gjspX6zZ2Rb+NxTe6m2LannQuYOYkvK2 g0j0hWujaHm65KEVucdfpWX/B8/MBhj5imPM70pZldVx8PowFKNVuP1GLWZsA/KDEHKR 0EIA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=98TIgGcF5QpWM5jqnKUiMqwzL4ec7B61vjYW5N3VNTw=; b=OR3Q+vCSvhMWVDCXf0WGclYJdLuqDq/T+Sl8RshTlkvbMyw3FU4rq1dVlUKCdxKAvx hyELrOuMMrpncCx5bRwqqBS6SIXCQYJSxE1DOJqigMqrNTeMXru0epQQDJaljhfIqXqj V0b9c70I4ljXnq2OfUxa4aWl098KorsuGez7RKt5jAemPm2/XQF0lAWMiEIjolrO2Iiy EuiX8b+WQK+jxFL6qr8pdzmOdv9JoStRT/94YBIjL0YsfQWAuiEU/sHlZcYWZBaKl9lY vmw0B6yENhUOR/WsBnlEz0JPRxVdg07LBA8ri1Cx1O2qqJgL4kAOrb/BWcBMeTmaVXTQ dBuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VLTXxX1b; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si3606755ioe.21.2021.08.19.11.09.59; Thu, 19 Aug 2021 11:09:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VLTXxX1b; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-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 S234317AbhHSSKe (ORCPT + 4 others); Thu, 19 Aug 2021 14:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbhHSSKe (ORCPT ); Thu, 19 Aug 2021 14:10:34 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B5C9C061756 for ; Thu, 19 Aug 2021 11:09:57 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id k29so10367021wrd.7 for ; Thu, 19 Aug 2021 11:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=98TIgGcF5QpWM5jqnKUiMqwzL4ec7B61vjYW5N3VNTw=; b=VLTXxX1brKA+iPAowPeK0fPIq0jgshzN2MD7g8aNen0SZOUnffRmOo5vPmn6+vpLQh y955nkaufeHt8PRBafJHIZeIkVm6EXt6Kk+j691BkSgzQGWAqNPUnZpdHECgnClOlpyB V4B/lYPatYf/ZFRZX+awPSO+yriIq9V09/BSZOg05BlOy2Q2ea/7p70OxRDqRCihUJoV JwjRuN81oER0gtQROOLbMEq3QhwCMbQ3uqW8lRbsXb3fyCWonGXZ91tdB2Y1GF1e07zp ibpSFHrEwA887GlCIMOA86+PICG/T7IesFzR31DdMresrstLeWHKzqIrEAuZp1UQAeDF zLgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=98TIgGcF5QpWM5jqnKUiMqwzL4ec7B61vjYW5N3VNTw=; b=Z32Tyleh5U1dJgPXln4uglIDCfAUR6wDH1XVs9SfuvFxVEwhenB3hXCc8F54PR8U9h nFEp+L76TXSBSW4tdpCo8bozVvNbUimtK8rjBUU/SC1l7juRVF9Lpbq95rYr+Xgz0Y5D sobnBOfu3OyBCgno/sobM+JJpv2aZPWyI2oQ8KrEaMQv7G+pGMh0puK47df4Ahc6Kjam bbbYEkVy/iSQTgQu1CiLmAKGh+SR7Lx9hjT3gEZzTMvmi0QDS0aoXvJtmmXrfkPTXYmX VhXnVWs1cRaKygpquxNjOx34bahdF/kEJqbYhQ6yO9fjrvd/PYefWoq+N82vTQK2ADfP Dsgw== X-Gm-Message-State: AOAM533lGX0aZ6CnlBhPLT/1JyFdo9AiDn086ZQOwWdqmfthx4xWhdU0 ZQ0hY0KbXtTazW+M/JSwnMSgnw== X-Received: by 2002:adf:d4c7:: with SMTP id w7mr5511212wrk.301.1629396596272; Thu, 19 Aug 2021 11:09:56 -0700 (PDT) Received: from arch-thunder.local (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id h16sm3625668wre.52.2021.08.19.11.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 11:09:56 -0700 (PDT) From: Rui Miguel Silva To: Greg Kroah-Hartman , Alan Stern Cc: linux-usb@vger.kernel.org, Rui Miguel Silva Subject: [PATCH 5/5] usb: isp1760: clean never read udc_enabled warning Date: Thu, 19 Aug 2021 19:09:29 +0100 Message-Id: <20210819180929.1327349-6-rui.silva@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210819180929.1327349-1-rui.silva@linaro.org> References: <20210819180929.1327349-1-rui.silva@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org When CONFIG_USB_ISP1761_UDC is not enabled the udc_enabled variable is never used since it is short circuited before in the logic operations. This would trigger the following warning by clang analyzer: drivers/usb/isp1760/isp1760-core.c:490:2: warning: Value stored to 'udc_enabled' is never read [clang-analyzer-deadcode.DeadStores] udc_enabled = ((devflags & ISP1760_FLAG_ISP1763) || ^ drivers/usb/isp1760/isp1760-core.c:490:2: note: Value stored to 'udc_enabled' is never read Just swap the other of the operands in the logic operations. Signed-off-by: Rui Miguel Silva --- drivers/usb/isp1760/isp1760-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.33.0 diff --git a/drivers/usb/isp1760/isp1760-core.c b/drivers/usb/isp1760/isp1760-core.c index ff07e2890692..cb70f9d63cdd 100644 --- a/drivers/usb/isp1760/isp1760-core.c +++ b/drivers/usb/isp1760/isp1760-core.c @@ -491,7 +491,7 @@ int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, (devflags & ISP1760_FLAG_ISP1761)); if ((!IS_ENABLED(CONFIG_USB_ISP1760_HCD) || usb_disabled()) && - (!IS_ENABLED(CONFIG_USB_ISP1761_UDC) || !udc_enabled)) + (!udc_enabled || !IS_ENABLED(CONFIG_USB_ISP1761_UDC))) return -ENODEV; isp = devm_kzalloc(dev, sizeof(*isp), GFP_KERNEL); @@ -571,7 +571,7 @@ int isp1760_register(struct resource *mem, int irq, unsigned long irqflags, return ret; } - if (IS_ENABLED(CONFIG_USB_ISP1761_UDC) && udc_enabled) { + if (udc_enabled && IS_ENABLED(CONFIG_USB_ISP1761_UDC)) { ret = isp1760_udc_register(isp, irq, irqflags); if (ret < 0) { isp1760_hcd_unregister(hcd);