Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp297089pxh; Wed, 10 Nov 2021 01:52:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLrOLNFgEnS6lekTfJHDshxTq8R6Tatcqu9iYCnECEwzC5tH+fpFcFsPq8GvRj07GLV85F X-Received: by 2002:a17:906:b51:: with SMTP id v17mr19545512ejg.262.1636537974187; Wed, 10 Nov 2021 01:52:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636537974; cv=none; d=google.com; s=arc-20160816; b=nI0qxl5l/Pv77eu/FPmFQ+eQ9fMtyxX5txWQz/jJXb7ujVp7MIV+sO09hRCzHpHj7Y JPrIeIYPbd7DTObRaaza1cdrhdQ3jWpmnxxwHxGxqYpQMVTgf6G9vx/y9qk4jizJYytG 7ikpsPVlwx4Z96uKWNKCpfgAigRQYBjEOVQxCZ/2V/ciK0yY2XZ9/8O6VIiRZ17+ixzt slRDw+v3MutbxCivNXVsfJrsCtWiALyyuMbLMQShFn48uLp1TVmchkOdjceR932ueDJe ksXQaDoaTMS8zpqlySLQrsYhKC2ZLGr2q9i0UaeRRlToxpIX1jTwSDh/qiUQQkMaJGpQ mqyw== 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; bh=zznPJ1jZnlSQ3BCS8sp7d6+YEsJgQvsRwL9zveBmaxQ=; b=ar/ieUfoqzpVDURFBJbiDrv4hmZH+WOaQKBSnJnIIahkvZCn3faRqgSmd4lSvRYvJ9 HyH1GoWWq9a57eOOGkMPVfXn163Kk41i/5bMf/VfvXaY8YDM8Q8zOIAed6Q5v2NwQ3lV gHXURRFjsLCigNc1CklaQr9qAPUq9oG9RKSQBy/LQqH+JFflwR5UeZ4/SmcxWHNXUpdk A1ORfC4M5adYeIp1yLNfeRRwy+yX2PIjJEvAy9JeLPR5H9FTk23A8KzNXFTIJXjeZAJG ftRZSj0Q5Z1yDp7B3iyeFgXY4gtQ0VBvCnUb+eDFYbUsinf0R0jAU4eDTfeG+VNe+kH1 KhsQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sh9si44489670ejc.395.2021.11.10.01.52.29; Wed, 10 Nov 2021 01:52:54 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230440AbhKJJwm (ORCPT + 99 others); Wed, 10 Nov 2021 04:52:42 -0500 Received: from smtp23.cstnet.cn ([159.226.251.23]:58192 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229653AbhKJJwl (ORCPT ); Wed, 10 Nov 2021 04:52:41 -0500 Received: from localhost.localdomain (unknown [124.16.141.244]) by APP-03 (Coremail) with SMTP id rQCowACnr6uplYth71WhBg--.484S2; Wed, 10 Nov 2021 17:49:30 +0800 (CST) From: Xu Wang To: mchehab@kernel.org, sakari.ailus@linux.intel.com, gregkh@linuxfoundation.org Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] media: atomisp: Remove unneeded null check Date: Wed, 10 Nov 2021 09:49:10 +0000 Message-Id: <20211110094910.67951-1-vulab@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowACnr6uplYth71WhBg--.484S2 X-Coremail-Antispam: 1UD129KBjvJXoW7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9UAAAsh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In ia_css_frame_map, the check of 'err' is unneeded to be done twice. Signed-off-by: Xu Wang --- .../atomisp/pci/runtime/frame/src/frame.c | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c index 10c4907187d9..529decf3f57f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c +++ b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c @@ -168,25 +168,23 @@ int ia_css_frame_map(struct ia_css_frame **frame, if (err) return err; - if (!err) { - if (pgnr < ((PAGE_ALIGN(me->data_bytes)) >> PAGE_SHIFT)) { - dev_err(atomisp_dev, - "user space memory size is less than the expected size..\n"); - err = -ENOMEM; - goto error; - } else if (pgnr > ((PAGE_ALIGN(me->data_bytes)) >> PAGE_SHIFT)) { - dev_err(atomisp_dev, - "user space memory size is large than the expected size..\n"); - err = -ENOMEM; - goto error; - } + if (pgnr < ((PAGE_ALIGN(me->data_bytes)) >> PAGE_SHIFT)) { + dev_err(atomisp_dev, + "user space memory size is less than the expected size..\n"); + err = -ENOMEM; + goto error; + } else if (pgnr > ((PAGE_ALIGN(me->data_bytes)) >> PAGE_SHIFT)) { + dev_err(atomisp_dev, + "user space memory size is large than the expected size..\n"); + err = -ENOMEM; + goto error; + } - me->data = hmm_alloc(me->data_bytes, HMM_BO_USER, 0, data, - attribute & ATOMISP_MAP_FLAG_CACHED); + me->data = hmm_alloc(me->data_bytes, HMM_BO_USER, 0, data, + attribute & ATOMISP_MAP_FLAG_CACHED); - if (me->data == mmgr_NULL) - err = -EINVAL; - } + if (me->data == mmgr_NULL) + err = -EINVAL; error: if (err) { -- 2.25.1