Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2656853pxa; Mon, 17 Aug 2020 15:42:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWIRqaV8wAnZxOqZIyn1l2LZvKjA6nggxw8rsnDCBjkVooVLrQM9LqUZAkjUoOrrhP3zPf X-Received: by 2002:a17:907:20e1:: with SMTP id rh1mr16693686ejb.106.1597704142541; Mon, 17 Aug 2020 15:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704142; cv=none; d=google.com; s=arc-20160816; b=dg3fhKyNv4FM54zM1nU1tHXBSINQamoxt8/9U+a7ss53a2OAcZt3tHJESIZYOEuROd 5iksH1JV/bxgyDV8P/ZlSpnPgPjlTKdMOqJSAY3rwR/+s0W4PV2DjTiwm5ot/ICoT9oA 3G8UeYJM3sRr4il9Pf6G7Cf2OzMDp1gtrmW0y4f9B4wT9tZ2yGzyaowiIfD+ss9dmTEI q+UTh2LhKMcO/UDUAzq3XtXA7I6Zzzc88kQuv27RyFo6EdPLispuzZkBSSIE2cStMgEI L4tyDuoNNllsJIFsw4GSqE5OdmGsimtmGHM2jSfOtRMKQO0QMvb1KozEuJk8SLpK2P25 JY/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jNZ5IxwsEhVfcjNEPm/tk69awkeIBSmxHqqnHvvS8Hw=; b=qcSVT3kkN14b2KvGPyz007TxT0bPtOhYZQg0IjvO1B2O/WrQUgS3hLVM4nLpa2qsFP PIp0jDwPWgq22ZiEsbruHhFMfqdRDe4F9HYVOdhlDslqxbuRa6TOHWil2ju/Z/XsWhzr 6cD0BdLd4HoGl5kwv45rxe6tjZMHHVZmHuYYy2ck8BD7+fWaNz9nxyMTBSX18VGJOdsE wBFk2FNf0qjZ7eswiOr1XaocF8KZ5n6GXczTFbKQxpprJm+OlF4+Q0NSoRC9yTNAgkcZ pZzOXHMqLL75FeV8yhLUlocK2zGVCrh/nZALjd2mw+y6Q3yWQph/hkPLN8naDgAlsKjt skDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0cuE9ISF; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy23si12471590edb.311.2020.08.17.15.41.59; Mon, 17 Aug 2020 15:42:22 -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=@kernel.org header.s=default header.b=0cuE9ISF; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730968AbgHQShf (ORCPT + 99 others); Mon, 17 Aug 2020 14:37:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:46252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730942AbgHQP7D (ORCPT ); Mon, 17 Aug 2020 11:59:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 713732072E; Mon, 17 Aug 2020 15:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679938; bh=cXb3Y5smLW5QBd7bhkE4c6NgmedioV81GoTjsOk/Jzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0cuE9ISFCnXGPDDroC4j4TXCUO50x9oN8lX/SOJBIB5/wy4nxMbarWSrj+nPXCDU7 0grLbqgMN4Dxm7qWk4Z9rJSiFogrNNvk8QP+NDCrTw2X8tXH0gEAmOm/jPO6usBTu2 MDMcEDZide5rbUGYzmXZLjE3lJ6HNoIvgdHeIuuw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksandr Andrushchenko , Dan Carpenter , Juergen Gross Subject: [PATCH 5.7 384/393] drm/xen-front: Fix misused IS_ERR_OR_NULL checks Date: Mon, 17 Aug 2020 17:17:14 +0200 Message-Id: <20200817143838.228903172@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oleksandr Andrushchenko commit 14dee058610446aa464254fc5c8e88c7535195e0 upstream. 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 Reviewed-by: Dan Carpenter Cc: Link: https://lore.kernel.org/r/20200813062113.11030-3-andr2000@gmail.com Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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(struc 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; } --- 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 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 */ 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 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 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); --- 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 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];