Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp100577rdh; Tue, 13 Feb 2024 10:32:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV+YDMcQam8P+woCyn4YBJ+3P8UkfdHLFZ5c4WeKLDXGEJTRvB1gOJe5RaflfVdQg4tiUNeCP+qET1y0cXEXJK7o6cX4MCb7ByUUvQ5EA== X-Google-Smtp-Source: AGHT+IHm5tiJuSV13WFEY4PkNANsKFGMhPevHEdbdr3vq9CMYVUQdu8lP2ewWNRGbzJDRuZs48NC X-Received: by 2002:a05:6a00:1493:b0:6e0:a2fe:5b4 with SMTP id v19-20020a056a00149300b006e0a2fe05b4mr5041982pfu.15.1707849127101; Tue, 13 Feb 2024 10:32:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707849127; cv=pass; d=google.com; s=arc-20160816; b=lc+4/9Il4HLuCSpQyjxMhO/ebTGUBF6XERSKzPyhs821zhdouyIpb0VD1qwAm9bvzG PZKt3q22+jagIGHFCivgD3YncugjNukVPcCJ0z5LqeVWnJrzfZNfwRIEUP27RuwZMsT2 3o5eXfUOAtyEMj5CI8I5vkTXOnqDMxa7xC72K14+x3CIykudeuTK3aPj1QFpUJ3ZwKZE 53iCdX4bZaZiRHUViEYOCgTPtrgqr/opSiE01V6y6i9JiuJUis8q/2PO6U4mOLlfdPzY lVW/8vZuSbskw2MLIW2HmD/oI5FwlErHtEaDqe+Cgw1NHHInz9SgTKCF/6QIzPHHJXeg 8qdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=e70wXDD4s58i4pPQoq+fOfAGn7fmyRVc02WAzyBJDv8=; fh=fIGxk394JpyaTJhFn+lvn5mKM89dUJPO5kHdDqMXxsQ=; b=RJeKClNeyxn3m6Gxd9TSt9TiG5wOIZvWZ9oKXHkPafDH/yHPsNy50nxkyEVXbIW0BP TD/6lzgR6NBp/RseDo33/8kg0nXdVf4PNfh5SOYrzOi67sWwlign4BPIoR8UZXUzFhBa v8LVQ14V9xDX9J1vhxTn3PPC7AD+mD5d7wqAtGFVSfBPEELJumZL2AEAAV7uB1j4XTUT o1mR/PAoWhiAXaHLYdmcbUetgg0Y22ZGEqMo52peiw00po6ZbV2FHknO3muvt20kGHTk LD560t2qQ5sp5WuEFhvGodbuov5VIi4dC5FQzqZhn017Hyc7/fCkk+ykXyPgqINDy6g5 tmRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VD0rR1f1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-64050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64050-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=2; AJvYcCXnskviZ7GzklZDoDuhM/f6nNJyfxCB4cOTebWz+5ansyz+Ip1eFnEh2LKcHFOOzzZZwZ32mYf73It2QBNVswwJFSku4mvn2r2OZB2jrg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o25-20020a639219000000b005dc7e784005si2179742pgd.517.2024.02.13.10.32.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 10:32:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VD0rR1f1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-64050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64050-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0DE04B2B3C5 for ; Tue, 13 Feb 2024 18:05:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EDF9D605D0; Tue, 13 Feb 2024 18:05:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VD0rR1f1" Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FCCF604D3 for ; Tue, 13 Feb 2024 18:05:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707847512; cv=none; b=dEIabevurqHBbcrPSGEj5kCY2+4qYm/AQiQS1TumD2ZbKcB2+/HwumiWC+4lzw+IeG64basNGcOHPDgy7mOrw7O1kDpm1YmUbn0SspjePqrZPL0gxoKAKpuLRjgesqOvG0RFnxUcAZ/EH1XipDNJKPf/nUMK5m7uE85RKuWEoAQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707847512; c=relaxed/simple; bh=DRenCHOzrAHmNtT+PvrsMVMW+9QGYX42vbTeK9y9TM4=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=Ql2pqj/wzMHtoSaate7jni1ohsbdKOmsrBwuoBC/Dzc6NSqccD+5w882yzAerPyP9iA8OVtrOroS2JKPMO8gSQFz5KaaG6h4uJjpgMcbgGrGuta300PhhZQtQEa7UYkqx4Po1qiaB8d1r4a6plms9h5WMlHuPklqQ4IxD3bfb3E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=VD0rR1f1; arc=none smtp.client-ip=209.85.208.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2d0aabed735so60597821fa.0 for ; Tue, 13 Feb 2024 10:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707847507; x=1708452307; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=e70wXDD4s58i4pPQoq+fOfAGn7fmyRVc02WAzyBJDv8=; b=VD0rR1f1iqPok6dfdNePNbElqeGSyX0nJLGOw94OojWj0yetijyckIMKTL5E4b/Fbp 4dK9Sj05R5v+Gs+Xm651I6OaPOxaciHo18QofYH13dbeLn7EJaeqyssYmnN6xf6461cX hA2aPZMQpMDQCL2lEfHk0c0s3gB5gwY3ArLiXE0hogB65uch7ZpHPwnej/trVnK/iYV8 aPsdclHkG6LvhPBPTNwjf34VkbwFIXgO2ZXsOKK8QRnFKE7LfC2Qj/K5an5vDm1Yg4dq 10f61ocuaJLulCsfabESr1SSropLRkpYaLm55j8H6FW2N7txyMj2S4BWYDX2BQGVs4/R lA2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707847507; x=1708452307; 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=e70wXDD4s58i4pPQoq+fOfAGn7fmyRVc02WAzyBJDv8=; b=SlFDWLYsGhPzDgyOfI0DLQiBZJOkQG1Y87seq9uw3oHZz9xBsMEAwryMX9PQ85dFDT rA2bnw/GF11x01IakNZw7Ta477cXC4CbzACeDVfyUm1o/FKc3wv9Coas8oMZA/oqk+O6 odsB5ekq+CvGCQuSyQCXSbM+p/w4A0M7ub8Y10yf2RVPsmEHZmuzz1JdZByO8RTtk96p SYyuovdSzZG5KePw/j4lXU1QTiuDZgjPlQc8jcIS4CLNC7ueDwZ59PKIARfOTXu+oAjn nmpRVLCLWHFLCt5jMYRPyJyGckgiP3wKtBvau6m/572/yZwhCNIqtHyA0JADLQ1sMwo+ N2Xg== X-Forwarded-Encrypted: i=1; AJvYcCVlVvxbBrWdJVYF/Q4ZW5IBnabHRSVZiabab7golct4PlVdoyigerSRRbzyTDk6qserdtOdJxwB7GWNxIPM3jbGIDteNe9eaXyHjt7D X-Gm-Message-State: AOJu0YzVdntX3xoe9u7WFQN2ZItCK+7FLMg51Hu9UIX69NE1U1qaK6y8 XQKZSwlptsF5iB/HmfiDSGzx/qMcSXhcF31QHtWOOHNzFFw9nwh541clM5v6k7I= X-Received: by 2002:a2e:2e09:0:b0:2d1:ca1:760b with SMTP id u9-20020a2e2e09000000b002d10ca1760bmr297273lju.30.1707847507407; Tue, 13 Feb 2024 10:05:07 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWZ54WrawIOvlpxGz8yZKRDQ4SqXq+ERsBBvUjJjAj9qIo+bWEyrtNeTqIAiLi9LXVheQhFRx9UR6ajW92PZ+CvHLgnewa2EHey+1qbM5k6vFOqj97RVJ+DGojyFT8KwZtvgHrqGU9IPR4yGbV7GBdYJt2IULruG++q1lypc0xAkiG2Oh/ePKKJ6k0cZhn9x5CzoFHWTvZDrU1iQBLyUrF4Eb7KG6vjhkTVbsR4+YZjkeZz2Lk1kUd8QLhJoDAtCk1qKUv+RisDC2l7/yiHlPLnJhOUrqkDMCPA7waGTcg8DdN1tNI0rceLgid50LvlR+6BNKq+VGapvGwAv7CEq41MUsQZ3gqHFeawGmBtfuvghXbxoeYSC1mp06StN5ZL5lVqWurMvYL/OHtrq7O7wOQIedPShPXsBh5kTf/q8wxfD4HTEIlEbjP4G70TvEm8D8Qz+gCu+8umWLo3TMvAem9GcDkf6HfHjRUFvRx7pMOG0uBBd1d6DBNRXpTN9PIikhzbFmHUOIGYLC1v2rqRSMUXHdyKfCfUV9S0qT1C0C6U32aKxY2L4cQLx8CQW7drWAr9rDxmjV8VgdM3fmQhTstf/Q== Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id j1-20020a50ed01000000b00560ecb22d49sm3827246eds.84.2024.02.13.10.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 10:05:06 -0800 (PST) Date: Tue, 13 Feb 2024 21:05:01 +0300 From: Dan Carpenter To: Philipp Stanner Cc: Laurentiu Palcu , Lucas Stach , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] drm/imx/dcss: fix resource size calculation Message-ID: <4914592b-4256-4c9c-bc1d-6dec1e473831@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding The resource is inclusive of the ->start and ->end addresses so this calculation is not correct. It should be "res->end - res->start + 1". Use the resource_size() to do the calculation. Fixes: 90393c9b5408 ("drm/imx/dcss: request memory region") Signed-off-by: Dan Carpenter --- From static analysis. Not tested. drivers/gpu/drm/imx/dcss/dcss-dev.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c index 597e9b7bd4bf..7fd0c4c14205 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-dev.c +++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c @@ -167,7 +167,6 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output) struct resource *res; struct dcss_dev *dcss; const struct dcss_type_data *devtype; - resource_size_t res_len; devtype = of_device_get_match_data(dev); if (!devtype) { @@ -181,8 +180,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output) return ERR_PTR(-EINVAL); } - res_len = res->end - res->start; - if (!devm_request_mem_region(dev, res->start, res_len, "dcss")) { + if (!devm_request_mem_region(dev, res->start, resource_size(res), "dcss")) { dev_err(dev, "cannot request memory region\n"); return ERR_PTR(-EBUSY); } -- 2.43.0