Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp27963pxa; Fri, 31 Jul 2020 05:53:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzBcCZMo0J5jQ0d/5cwlF7WHMAF4bDDDkaiWzwmAJ0y0hqEVObAOlazebDhL8CqfObaINK X-Received: by 2002:a17:906:1254:: with SMTP id u20mr4179068eja.540.1596199992547; Fri, 31 Jul 2020 05:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596199992; cv=none; d=google.com; s=arc-20160816; b=GVDNZb6E38a+pd6/o6omtKEDU4VOk+OoSFcwN57KirwgiumQgs3QcErgkwfAfkmM+W UNjj4xeHHbJ4nAoHAB/aQUnYHeLNyoS943hSPkOwGEI4IstqLi1kLMLbRAP0SvF/MzuU MnKPVRNQG30Id/xIj9Wxk+JPAuYRaYUXTjYPcIn+M/pLCHqNREZYQ2sBN2FpaHt2r0sV 960yciAGxYCIwHV+ttnaUgGL7uBLxoCYDEwPx1NXbAfG6YajS2dygDAD9LBYaR5JgwH+ rZCDD92u2ULC5CdB3QutBZTkbtfIXR21SzaVzxFpLKdYLnKmgDpHW+aYRxZDLEKHRLf7 uoaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=hf2m1CaACgkl3i0FS0MjmjyDubimZdTD8G//CB5QIMY=; b=05N+JMKsQJlmHJX8K4QDHvMNTysp49rM6ZbDtFOQmd/QndOnuQBNxZqktoPf1oaH5A SUkLwrgONzE85+DkEVYElWuHdMCemU/kSB373iHQbbTmsqdQoWJ4ieE95hZf2ad3rKek 17Xtgo3VIsZlCMRExr38ZfP7+i1BySDV2JAnD9v0hcXVNN0BY2nC08sdy7tZQkhtMp/V 0b3kxn2cWQsTtngWD5yXzxiopCqmp8QEqicZrpY5JNOcq7UNE6SVSY7c68Ip6xdD2JaV a2wOoSyyEIX0u7LuJ5H72rT+yRwxdxn0omtmDZLba5NzUQF3TBkQvb+WsPhr6LSE0Xn/ JG2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WpFdItwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si5585165edn.449.2020.07.31.05.52.49; Fri, 31 Jul 2020 05:53:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@gmail.com header.s=20161025 header.b=WpFdItwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733275AbgGaMvV (ORCPT + 99 others); Fri, 31 Jul 2020 08:51:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730743AbgGaMvR (ORCPT ); Fri, 31 Jul 2020 08:51:17 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01E0FC061574 for ; Fri, 31 Jul 2020 05:51:17 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id h19so32295460ljg.13 for ; Fri, 31 Jul 2020 05:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hf2m1CaACgkl3i0FS0MjmjyDubimZdTD8G//CB5QIMY=; b=WpFdItwLmE1h/jcPKXj3mRmyaF+TKN3FWkbAvN9i01/b/GBnQQrfqTYPD3KkCl+HER 4a3yBnoP8xZ1+beeiIJ9vfMIpoL/Uq0aKjRgj9n3gDAB35PWSD+52cvI8qsbw9MMxnde Ogk+jE2mX/g7LFVkGpGWoSr7sD8Yog+cmIHDyOr5lEBZFzgPS2kU4Fuv8LCiEtAMJi4Y V/MPagzOAVhsCHI/ruYoFU5NgrrL0yQ5Bln8moUVlTyOMw3rTQ7cCkra3lYcATWDogf/ jBRFwFf8eSKHB5WoChdB5jL9GonvtcReyID4iSV0w2pPa3lh5NAPcP/9Jan5UaU8YB8u zvVQ== 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; bh=hf2m1CaACgkl3i0FS0MjmjyDubimZdTD8G//CB5QIMY=; b=SWK7tQ/XLO+rxbst2xx0TIa6jEH0AytNg73OcifyZ/EqhzwqJ5jh8PlUqtQ2jHvr2b S1jv+Aixyy/wNQ8dDATZ14tWK8uwXYuysssxgn/87U/612qfYwouKPRza5tUJlhRU1r0 JwF3hVNNYuE2EOh74pyU+R6yKGBvUdss1fDNysY77caKzZ2iAT7VbXiEq0POHVB1Yxvq Aup4Hf0Ppns7Vqna8ViwzfXd9/u0Gx9Ue+NM1TnlqjN6WTHUYWpzDHDJw7tB59Bgojn6 WpR237wzjKPMGG6+gDgqbiaxLGcHbLHDggk9+YXGCjn125TsM8w24CBvg0Cy4sgcX1K5 HxnQ== X-Gm-Message-State: AOAM533QvwNR5yESyN9I3WE63VQzyl05U1Q090PCY7SJgew0B3qJ9IMJ nG3PhXmh63TLgEqlhHVkq8c= X-Received: by 2002:a2e:9e43:: with SMTP id g3mr1932560ljk.309.1596199875447; Fri, 31 Jul 2020 05:51:15 -0700 (PDT) Received: from a2klaptop.localdomain ([185.199.97.5]) by smtp.gmail.com with ESMTPSA id s2sm1923362lfs.4.2020.07.31.05.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2020 05:51:14 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com, airlied@linux.ie, daniel@ffwll.ch Cc: sstabellini@kernel.org, dan.carpenter@oracle.com, intel-gfx@lists.freedesktop.org, Oleksandr Andrushchenko Subject: [PATCH 2/6] drm/xen-front: Fix misused IS_ERR_OR_NULL checks Date: Fri, 31 Jul 2020 15:51:05 +0300 Message-Id: <20200731125109.18666-3-andr2000@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200731125109.18666-1-andr2000@gmail.com> References: <20200731125109.18666-1-andr2000@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oleksandr Andrushchenko The patch c575b7eeb89f: "drm/xen-front: Add support for Xen PV display frontend" from Apr 3, 2018, leads to the following static checker warning: drivers/gpu/drm/xen/xen_drm_front_gem.c:140 xen_drm_front_gem_create() warn: passing zero to 'ERR_CAST' drivers/gpu/drm/xen/xen_drm_front_gem.c 133 struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, 134 size_t size) 135 { 136 struct xen_gem_object *xen_obj; 137 138 xen_obj = gem_create(dev, size); 139 if (IS_ERR_OR_NULL(xen_obj)) 140 return ERR_CAST(xen_obj); Fix this and the rest of misused places with IS_ERR_OR_NULL in the driver. Fixes: c575b7eeb89f: "drm/xen-front: Add support for Xen PV display frontend" Signed-off-by: Oleksandr Andrushchenko Reported-by: Dan Carpenter --- drivers/gpu/drm/xen/xen_drm_front.c | 4 ++-- drivers/gpu/drm/xen/xen_drm_front_gem.c | 8 ++++---- drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c index 3e660fb111b3..88db2726e8ce 100644 --- a/drivers/gpu/drm/xen/xen_drm_front.c +++ b/drivers/gpu/drm/xen/xen_drm_front.c @@ -400,8 +400,8 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp, args->size = args->pitch * args->height; obj = xen_drm_front_gem_create(dev, args->size); - if (IS_ERR_OR_NULL(obj)) { - ret = PTR_ERR_OR_ZERO(obj); + if (IS_ERR(obj)) { + ret = PTR_ERR(obj); goto fail; } diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/xen_drm_front_gem.c index f0b85e094111..4ec8a49241e1 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c @@ -83,7 +83,7 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) size = round_up(size, PAGE_SIZE); xen_obj = gem_create_obj(dev, size); - if (IS_ERR_OR_NULL(xen_obj)) + if (IS_ERR(xen_obj)) return xen_obj; if (drm_info->front_info->cfg.be_alloc) { @@ -117,7 +117,7 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) */ xen_obj->num_pages = DIV_ROUND_UP(size, PAGE_SIZE); xen_obj->pages = drm_gem_get_pages(&xen_obj->base); - if (IS_ERR_OR_NULL(xen_obj->pages)) { + if (IS_ERR(xen_obj->pages)) { ret = PTR_ERR(xen_obj->pages); xen_obj->pages = NULL; goto fail; @@ -136,7 +136,7 @@ struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *dev, struct xen_gem_object *xen_obj; xen_obj = gem_create(dev, size); - if (IS_ERR_OR_NULL(xen_obj)) + if (IS_ERR(xen_obj)) return ERR_CAST(xen_obj); return &xen_obj->base; @@ -194,7 +194,7 @@ xen_drm_front_gem_import_sg_table(struct drm_device *dev, size = attach->dmabuf->size; xen_obj = gem_create_obj(dev, size); - if (IS_ERR_OR_NULL(xen_obj)) + if (IS_ERR(xen_obj)) return ERR_CAST(xen_obj); ret = gem_alloc_pages_array(xen_obj, size); diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/xen_drm_front_kms.c index 78096bbcd226..ef11b1e4de39 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_kms.c +++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c @@ -60,7 +60,7 @@ fb_create(struct drm_device *dev, struct drm_file *filp, int ret; fb = drm_gem_fb_create_with_funcs(dev, filp, mode_cmd, &fb_funcs); - if (IS_ERR_OR_NULL(fb)) + if (IS_ERR(fb)) return fb; gem_obj = fb->obj[0]; -- 2.17.1