Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1201349pxb; Tue, 8 Feb 2022 11:29:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxm0KN5cI9bHtjXbRHMN5VZgi/xAV1lXEmUUQNHjPH6wPxN+9b1VOxNv9mPkqh8CJsX8KMr X-Received: by 2002:a05:6402:440a:: with SMTP id y10mr5974137eda.215.1644348566703; Tue, 08 Feb 2022 11:29:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644348566; cv=none; d=google.com; s=arc-20160816; b=xpS6UpL685Fo7N1ElOY0x27KY/eCMvd4/xqlAdZt+CDnzZfXIJsC7r7icMTF5Qq6bl bnFWt+HOt6tfpLYShN+KDJscHtPBDLqa/KJ6lJKgdPVhaBatgKe+QULBaGzJEr1g4tJ6 9byhx4GPfohIgvhWfHumNfoz/kdG6vkEoR7zufciL4gJfLBBKoKi2Bu5Nxfu4ONNqqJ2 pHuI+51gOCr8LTJycx9BpRSN9O5+l1cWfcf59nUs+T1p3d8vFBLeYI4yGSvAhJi9rbBi SaZKdPN3l/nSzRVAiJp9xQ+YCWGgqQFNE+qOFuH4ErccKh47pTkTj8ZCs09FO8C0u3O2 Dz5w== 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=8dDnEZB1SFPvZQSeoNuxhaaxs/J0YaV3CS6R1jvhiWY=; b=uTsp8KD8x/BkXe2kCvOgKz8vpt+h2GcuwCOKidFX8SS0C0ijTKAwbX2r0id9VEch4Y a/LEVdMxLctyfkwk5I15tnYXSdWIGeZRmnOb2n2HJQmoRmydiiPQPBo36unzeT0TiNtm I3xMY+ykUYAeCufUY/9zb6Ng5yqUH3ENPwLc5AEw0HViIAsUkz/4h6QCLH8O9MNd6wZo EEhH1L6MekSuDM+ECJl2g4BhVThOz4DtIoJWtNmPPfI327DUu2F3EmzBONwI9lDB+1Cb 794CDpvLwRxf/FEYne3Kw1mdAjk5oKTo7CXCMlC2MQk266GWiEUMfqKmVdidNQ64EQvu EK9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="daQ/U5Gj"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u2si10661806ejy.28.2022.02.08.11.29.00; Tue, 08 Feb 2022 11:29:26 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="daQ/U5Gj"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345623AbiBGQ7M (ORCPT + 99 others); Mon, 7 Feb 2022 11:59:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344389AbiBGQxS (ORCPT ); Mon, 7 Feb 2022 11:53:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25D1CC0401D8 for ; Mon, 7 Feb 2022 08:53:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B82EC61012 for ; Mon, 7 Feb 2022 16:53:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D23FC340ED; Mon, 7 Feb 2022 16:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644252797; bh=X39xYx51fikLum/6dHtmOj01yGauqmQNBgR0dA+t/T4=; h=From:To:Cc:Subject:Date:From; b=daQ/U5GjWfNjCv/LB9Bb4/XbLHnn7bL1gcbSSNpasT2b/VlhN0hVFOpSqKam/0dEa bpyiUxlfQlTzbqNwEtgG7vDWrd8uTKgWFaeN1z9j77gL17m0Fwx1GvlcoFD63IOhZ6 aUAt6UccpTa0iMVMP9JhHEpJoTaCOugnlvW8u+Xcb44//9MHg7zH6jZkEevSiBr5bN xJhMylojME3ZonO9bIqbR2RjxTze8Mkm7FQcxq352Y2N5gUjNNJ/fGADzZoIUk2KIm pNe/efhQ4UaqmLRW6nyXUhxuqSKaDTbO0GKhwVkYXJ8XUDIdziHpTCA1yN/rYFThfc pTYRUq7PJmu3g== From: Nathan Chancellor To: Yannick Fertre , Philippe Cornu , Benjamin Gaignard Cc: Nick Desaulniers , dri-devel@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH] drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config() Date: Mon, 7 Feb 2022 09:53:04 -0700 Message-Id: <20220207165304.1046867-1-nathan@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Clang warns: drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~~~~~ drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here val |= LxPCR_YCEN; ^~~ drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning u32 val; ^ = 0 1 warning generated. Use a return instead of break in the default case to fix the warning. Add an error message so that this return is not silent, which could hide issues in the future. Fixes: 484e72d3146b ("drm/stm: ltdc: add support of ycbcr pixel formats") Link: https://github.com/ClangBuiltLinux/linux/issues/1575 Signed-off-by: Nathan Chancellor --- drivers/gpu/drm/stm/ltdc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 5eeb32c9c9ce..447ddde1786c 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -624,7 +624,8 @@ static inline void ltdc_set_ycbcr_config(struct drm_plane *plane, u32 drm_pix_fm break; default: /* RGB or not a YCbCr supported format */ - break; + drm_err(plane->dev, "Unsupported pixel format: %u\n", drm_pix_fmt); + return; } /* Enable limited range */ base-commit: 542898c5aa5c6a3179dffb1d1606884a63f75fed -- 2.35.1