From patchwork Thu Jan 26 09:28:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13116822 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 E8F15C05027 for ; Thu, 26 Jan 2023 09:28:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A0D210E296; Thu, 26 Jan 2023 09:28:57 +0000 (UTC) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5668210E296 for ; Thu, 26 Jan 2023 09:28:55 +0000 (UTC) Received: by mail-wm1-x32f.google.com with SMTP id l41-20020a05600c1d2900b003daf986faaeso694365wms.3 for ; Thu, 26 Jan 2023 01:28:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=/IxBVmoaeMHgo4qohihhRMExp2vqEbWrBTuk2dZo30k=; b=MfLleEFuHVk5Eqk2rl0bV08WiVj4OMVvz1lAR8CvfOzu4JZhnamDCEDGgw9pcxewwc QBKA/M54UwJS50/Za8zbcHI2HX7J5HAlG+8Nt62iTxKSQSDwhymzbIDQq5D5PbZLZ2En tlbtVPoQftM06dwGqqKniTBMLs1jZOO4xqSy2Bp6pfQN/1+1jaVOBrbaQFQLcEh8I4zw ZSnbwvbqDzJ/kzSunWbJCeZns6ytbsCdttKSXnPUfnIBNtN1dIO/zdXTaYuCaaVekxGZ SmJHG/vnxnzAtWl7jZ9MRixmmuqrpcs9KWG1clJYHXmRXEJPWBOz7gKGddyY7WBoTByR MeyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=/IxBVmoaeMHgo4qohihhRMExp2vqEbWrBTuk2dZo30k=; b=39+Flf9r/9o9f2nUe81lqc5KKQnfshFjKfK0SQrzNqqPV8AjQ3N0I5CY2JGe1uy71A gxzybMmSe/KqABXIsoV2bxeeg3+JQcRDvEAt967HLfUs+6bUp7bXS09LgFfr5+6wFfuv psAM07jFjg3tKXNZjJog1r2AahMxrS8MWpDXgvXoKym0djRpj7KphVIsPTeF5rtUD/NP voKW+QziCXkATxjXn2B04kEQJeLS3WFa7zN25NpP4b59E5ee+ESvK8AbdwVoLj94HGJy SNqrA0KmhwJEM5LRxe7csbn9YgvP/P9NEe36VZf9C3zQl7Yqx3bfHbkNJmjgmXAJ07vG 8FXQ== X-Gm-Message-State: AFqh2kqx1Lf9gdgJb4tkvHomBYPxOybYBv1errDkLkrsaNWvi9T5QHlM FNnhYNWSSmzsJ5kVi0Zunv0= X-Google-Smtp-Source: AMrXdXvuPjKYrz6r9VXVEKS7W8Gs0rtLGgODZ1eB3jGVWEsIQmy5BB/BO50YeASdR8746CRa4aJQTw== X-Received: by 2002:a05:600c:35cf:b0:3d3:49db:d95 with SMTP id r15-20020a05600c35cf00b003d349db0d95mr34482619wmq.37.1674725333855; Thu, 26 Jan 2023 01:28:53 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id c42-20020a05600c4a2a00b003da105437besm932937wmp.29.2023.01.26.01.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 01:28:53 -0800 (PST) Date: Thu, 26 Jan 2023 12:28:44 +0300 From: Dan Carpenter To: Thierry Reding , Thomas Zimmermann Subject: [PATCH] drm/simpledrm: Fix an NULL vs IS_ERR() bug Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding 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: kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org, Javier Martinez Canillas Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The devm_memremap() function doesn't return NULL, it returns error pointers. Fixes: 9a10c7e6519b ("drm/simpledrm: Add support for system memory framebuffers") Signed-off-by: Dan Carpenter Reviewed-by: Thomas Zimmermann --- drivers/gpu/drm/tiny/simpledrm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index 2acc0eb32489..63881a3754f8 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -719,8 +719,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv, drm_dbg(dev, "using system memory framebuffer at %pr\n", mem); screen_base = devm_memremap(dev->dev, mem->start, resource_size(mem), MEMREMAP_WC); - if (!screen_base) - return ERR_PTR(-ENOMEM); + if (IS_ERR(screen_base)) + return screen_base; iosys_map_set_vaddr(&sdev->screen_base, screen_base); } else {