From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BDC7ECDB474 for ; Mon, 16 Oct 2023 17:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xq3mL3mjwEp2yKQTXBmV1c1beExa9dMUafn1qs1umWI=; b=Wua1fpj+k8N3c1 PtG7hz/DCit5e864VZRtNPhPGFj8vRHviG+iykmjdB8CrpBy/OQx3rohibAGjZU5rz/Kaz2bnfN3B XyDul/OixzmWu0KEDsERfH/7MUOw1IJxIZas7sd0RVkOeF542/3lQmOrISZzj2Jqd59AaDn/JhrWY Oe+Sh1zMj+6yLS4rX4lumupp6i4nz6vSp3NejF8ykT6d0X9tonio6ltaYKNtzWkblbd6KXC3BnSsb PQBW/QyG1NmNr1U43T4dCp4zXIQW7b1x5UiUvl/Y80pSejflVWc4kGSyD9HdINAPzuBriqYk6+W/w tkY8+hvJBmAFdqrQdqsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qsROu-00AERT-0V; Mon, 16 Oct 2023 17:29:08 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qsROq-00AER8-1F for linux-arm-kernel@lists.infradead.org; Mon, 16 Oct 2023 17:29:05 +0000 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3b2b1af964dso2471270b6e.1 for ; Mon, 16 Oct 2023 10:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697477342; x=1698082142; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=LmGiWDU9PXt+YAggrEnC/Bk/hTqS6qfb5Emwx53MAJs=; b=EGMseJ6x9tjk8zLDinDYm9YumiPCo/SXR2vIRYwpQjAx9jaTR8k/XqnHDWVtzPEGEf 8IeHuosJxK26EI1mSd+Wb2cut7/OtNSsOjoaaVW8O4s2cEaKZ83XSSguYZ2+gML9ASLd Oi91bLI+wN1OzJJwRgNNhJvZZxyI5TlARURSJFWmwex6fchOWZzBsBk+z/8xrdVJEky3 2xC/lDI4ZkEcXUQldw/L64L+eZenG+jGgHQzWwWar24WWnbyy8YyfwIq3YJFGmaOJwvc u15ALQUBI7zc7I/tdx3czY9mpEANm8GGZQcuuT+FpcjTSHZlw/Z73kQjNBNPTRww0r2O D5bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697477342; x=1698082142; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LmGiWDU9PXt+YAggrEnC/Bk/hTqS6qfb5Emwx53MAJs=; b=LmE4juXp2ev+PPtD8kLct1mxiypiXyHs/1VLVzQmeCs01Ejakh6Mx8N9Yl7Z2m2bn3 lKuL0i0+TM8QvExW3GEmEPFlEjOLq73smQjx548igJs2u8Yq6cGLhmr5dusjGyw6Wi7P wUFDo2SvlzvVYphUV4bL6ViMV1VOUseqNpP6NnFReIEYZwVd9cOS662V8yP/6Ua5ihlq IXOc8adQH2hL020jEhjA5uGvu3vE0DG524qBQBtMVNEAzo3y8wuECyJiupVr7Pi7VNGO bpSotKbHCPlBGDjCFgaJfavLuTTzMA56ZB49mkF+3RAFwV017nekTEpBdDr7ad7ILhib skpg== X-Gm-Message-State: AOJu0Yx5mPvb0l9VsbhSewF+DXzplquZbsTnrPbqzHa2qtww2/oQkZKA LmH44yN3Hlh1+O+x1EqAJWcUKg== X-Google-Smtp-Source: AGHT+IEn6oj3+OG3g3K+JmO7h2NGo1Dur2TSSO882ulntrX3L84+CAKXG0csoUB1lRoMEXAUKwCvDw== X-Received: by 2002:a05:6808:91a:b0:3a7:4987:d44 with SMTP id w26-20020a056808091a00b003a749870d44mr36147099oih.20.1697477342559; Mon, 16 Oct 2023 10:29:02 -0700 (PDT) Received: from p14s ([2604:3d09:148c:c800:9add:9fdd:7517:f866]) by smtp.gmail.com with ESMTPSA id g11-20020a63b14b000000b005657495b03bsm8391754pgp.38.2023.10.16.10.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 10:29:02 -0700 (PDT) Date: Mon, 16 Oct 2023 11:29:00 -0600 From: Mathieu Poirier To: Nathan Chancellor Cc: patrice.chotard@foss.st.com, andersson@kernel.org, robh@kernel.org, ndesaulniers@google.com, trix@redhat.com, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev Subject: Re: [PATCH] remoteproc: st: Fix sometimes uninitialized ret in st_rproc_probe() Message-ID: References: <20231012-st_remoteproc-fix-sometimes-uninit-v1-1-f64d0f2d5b37@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231012-st_remoteproc-fix-sometimes-uninit-v1-1-f64d0f2d5b37@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231016_102904_444141_312A1CDE X-CRM114-Status: GOOD ( 20.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 12, 2023 at 10:04:01AM -0700, Nathan Chancellor wrote: > Clang warns (or errors with CONFIG_WERROR=y): > > drivers/remoteproc/st_remoteproc.c:357:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] > 357 | if (!ddata->config) > | ^~~~~~~~~~~~~~ > drivers/remoteproc/st_remoteproc.c:442:9: note: uninitialized use occurs here > 442 | return ret; > | ^~~ > drivers/remoteproc/st_remoteproc.c:357:2: note: remove the 'if' if its condition is always false > 357 | if (!ddata->config) > | ^~~~~~~~~~~~~~~~~~~ > 358 | goto free_rproc; > | ~~~~~~~~~~~~~~~ > drivers/remoteproc/st_remoteproc.c:348:9: note: initialize the variable 'ret' to silence this warning > 348 | int ret, i; > | ^ > | = 0 > 1 error generated. > > Set ret to -ENODEV, which seems to be a standard return code when > device_get_match_data() returns NULL. > > Closes: https://github.com/ClangBuiltLinux/linux/issues/1944 > Fixes: 5c77ebcd05ac ("remoteproc: st: Use device_get_match_data()") > Signed-off-by: Nathan Chancellor > --- > drivers/remoteproc/st_remoteproc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c > index b0638f984842..cb163766c56d 100644 > --- a/drivers/remoteproc/st_remoteproc.c > +++ b/drivers/remoteproc/st_remoteproc.c > @@ -354,8 +354,10 @@ static int st_rproc_probe(struct platform_device *pdev) > rproc->has_iommu = false; > ddata = rproc->priv; > ddata->config = (struct st_rproc_config *)device_get_match_data(dev); > - if (!ddata->config) > + if (!ddata->config) { > + ret = -ENODEV; Applied and thanks for fixing this. Mathieu > goto free_rproc; > + } > > platform_set_drvdata(pdev, rproc); > > > --- > base-commit: 5c77ebcd05acf3789949c8a387df72381d949ca2 > change-id: 20231012-st_remoteproc-fix-sometimes-uninit-7aff1bdb7349 > > Best regards, > -- > Nathan Chancellor > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel