From patchwork Fri Oct 13 08:25:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13420414 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 EEF12CDB483 for ; Fri, 13 Oct 2023 08:25:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA01A10E0A7; Fri, 13 Oct 2023 08:25:22 +0000 (UTC) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6191110E09D for ; Fri, 13 Oct 2023 08:25:20 +0000 (UTC) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4056ce55e7eso18860135e9.2 for ; Fri, 13 Oct 2023 01:25:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697185518; x=1697790318; darn=lists.freedesktop.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=M+uauCSgQKcWUCd6FsYiqka8NNHbjlLVkJ7rYh7s+Tg=; b=D0c6RpG11uFJFKXOupuYSTBxMsbSJfOmi36jmwCnOza0ZrUP0rQaRbpwHvrQ8YbQET XuPrfitwulEEViFVqYY0Q1POZRCSyjdz9o5LpaxVBvFQQrlMByURZcL+czpZn3V/aIN+ NUmUCPTj/qXJjZM0Dov5hjR1sOmIHVcukSFT52KH75I8vEqZFYQPpeiV4b0DNCa+mkO9 OUfMFjSvQrvocXW/5vpk7S3sscmaUYPxEcGy3NzmA+OUkl51yLhPEQfcfvD2n07p2/Ru N/Z/p3PsH9umKG5yJMAlwguGFFo0XGYPiuXBkosO/ftFP8ggYMeXaOUu/rVmNr8hzsrH viJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697185518; x=1697790318; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M+uauCSgQKcWUCd6FsYiqka8NNHbjlLVkJ7rYh7s+Tg=; b=ZBhsmHOWSBY+F8WeOFs7UeH1noGqPwxTNPSJMgELAdsP9j/r4zbsLNVns+GjbnIVMa N1bGCnwkCwFpq7pl9ID4oE5Yp9Ivuh4GSxgldtlygp8xNtvvqQZeZxg7d21XtdXd2R9i 0+jIRNcIlaDYFHE4YpEB6E2VNtvTgKSTuOCU+yu7+cA3M/gYEklY9dpq4DgrXmAMM3v0 S2PkZ1YWuB3qwpehJwdrkyfqGxx4kSgP8YGb7mt+FXb+JFeAiwK6gpJnpqR9MsDHuk9D fxiI2lTeAQNvPLOveetBuz5Ks35eudEhj7qKHVhDM3KwcgEwnqmxKcfYc7r0vOogfSq6 ADqQ== X-Gm-Message-State: AOJu0YzzIHv0wBs3ArtOj0EXrgXe5ZcI64ovjsbHdQGC5k9sIvlpIbZQ YXvHkMu9fDtYb19kC8U0QFj3ex2Ew8/u5bUn/+w= X-Google-Smtp-Source: AGHT+IEjRa/nZrp2h3uISb8MvRVIEmCnprt03btuSLuHCUEtgB3tAH3dRRIg0+64ePhtBFCv/YHqZg== X-Received: by 2002:a05:600c:282:b0:406:44e7:ef93 with SMTP id 2-20020a05600c028200b0040644e7ef93mr24194490wmk.1.1697185518504; Fri, 13 Oct 2023 01:25:18 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id t9-20020a05600001c900b0032179c4a46dsm20236629wrx.100.2023.10.13.01.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:25:17 -0700 (PDT) Date: Fri, 13 Oct 2023 11:25:15 +0300 From: Dan Carpenter To: Rob Clark Subject: [PATCH v2] drm/msm: remove unnecessary NULL check Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: freedreno@lists.freedesktop.org, Su Hui , Sean Paul , linux-arm-msm@vger.kernel.org, kernel-janitors@vger.kernel.org, Abhinav Kumar , dri-devel@lists.freedesktop.org, Uwe =?iso-8859-1?q?Kleine-K=F6nig?= , Dmitry Baryshkov , Marijn Suijten Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This NULL check was required when it was added, but we shuffled the code around and now it's not. The inconsistent NULL checking triggers a Smatch warning: drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:847 mdp5_init() warn: variable dereferenced before check 'mdp5_kms' (see line 782) Fixes: 1f50db2f3e1e ("drm/msm/mdp5: move resource allocation to the _probe function" Signed-off-by: Dan Carpenter Reviewed-by: Uwe Kleine-König Reviewed-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- v2: Added a Fixes tag. It's not really a bug fix and so adding the fixes tag is slightly unfair but it should prevent this patch from accidentally getting backported before the refactoring and causing an issue. Btw, fixes tags are often unfair like this. People look at fixes tags and think, "the fix introduced a bug" but actually it's really common that the fix was just not complete. But from a backporting perspective it makes sense to tie them together. Plus everyone introduces bugs. If you're not introducing bugs, then you're probably not writing a lot of code. drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 11d9fc2c6bf5..ec933d597e20 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -844,8 +844,7 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) return 0; fail: - if (mdp5_kms) - mdp5_destroy(mdp5_kms); + mdp5_destroy(mdp5_kms); return ret; }