Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp651675rdb; Thu, 15 Feb 2024 10:56:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUoVat96PS3z5zj1M088p5gPwgU2IbKX8LNCmmi79l3O2RcVEomqNpnd4M1xSuNhbexBjmhyBJFpKTl+W4NUS/pHh0cByMJ/RDzCIswZA== X-Google-Smtp-Source: AGHT+IHhHjqqRtylm2o3xxRs8ezSea9Fasjtho4PTd/TbcC+Zj/mkgn03EKhdrTRjpnPTYmpbrzT X-Received: by 2002:a17:902:db11:b0:1d8:f6af:77db with SMTP id m17-20020a170902db1100b001d8f6af77dbmr9914813plx.12.1708023376894; Thu, 15 Feb 2024 10:56:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708023376; cv=pass; d=google.com; s=arc-20160816; b=qNXYcP9UpRokbtNnzCpHN2SLUy+0toTRTlnBgG6zPlpiY+nzT6L3ClvJJAlGOgVx4U IhESYNIG77QQkwPsW1d/gazWwJfQ/LWGf2p5xpaSgYq/+z8y3CSNsPW5wT+knmMYxm18 6TZKD5guUGZt/Dijuc77PasboaLdMNl1qm3obVyLp825SpeJuPuJFUGyZx6JG0VkDuts Ic+yVlSJPLklOa0eY18qQcSblqRMpk/0jJLsOwPi0v9Qjnc8aP7i2XHCCFTSf77WP1xf k35kedkXpFb6CU6x0RFcOGzh/3YY8xxaZXqXggIOCWaGYYdr8c/+qabZHJiznMtVX7mO lr+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=4cAJLHNF/JRrCEO49lp/BKyIGOuJcZVH2wEu3LRWvvE=; fh=O87TIUUyv/jRqa/GoFh3beAE5UBO5bEH8MGihqV3WTc=; b=uOOC9iQm4k+4uwEBXogGgHWzS9xQxfhtywTfBki3JSmyHk7GXu+41ep3Uf70Jwg6Bj AWRyGsPP45fuxN4hN3iIXL1AyhvlYIf0QT1tyEKqkJ7ZgxvDF2VA2xiZOUnRo1lZBYNF 3Q4eXqrTomBdRbIfFpkfaY5nlkMmdB+WvS7Rhda8C+vGQufNGzea/7fZH1DOpKfEe5lD 1M1FtHux6mfNEYYUcdKb/Y4Le/1bMmf3rmwJgOGLDWmckHjpBAUc9xs7lfW1YAlpcb8x XUawOdV1H7sKGEgHYKYM5B9S6ZF0qvVz5g5cw+cWWCDridHMZVndhJBsA6DE0t7WP8UD ZDxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jSWBods/"; 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-67540-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67540-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f14-20020a170902ce8e00b001db5b2535ecsi1526542plg.553.2024.02.15.10.56.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 10:56:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67540-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jSWBods/"; 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-67540-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67540-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 98FF4287AB8 for ; Thu, 15 Feb 2024 18:56:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 768471386D4; Thu, 15 Feb 2024 18:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jSWBods/" Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 AF1B51EA7C for ; Thu, 15 Feb 2024 18:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708023369; cv=none; b=CtmFWQ6E68OPdMn3EhSXn0S4JocB9PguJ13jDKZj7bk6p3iHSxtRGrPkI9mzThqtyOCtgD+eQykF/r4i9WxSCmeX1OmDpioCxO7h9S7cqEzNZNItHKDrftLmemChok+Im+AAnJt0sFE0/jfUYst5/ZnUCfR4Yu4tPUblL/ds19o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708023369; c=relaxed/simple; bh=kXPQO+rEIu0FnBDjvhp7f2t/7FBxe0fcseMERvCf4No=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=WVnUvpm8hz7gpd1Rmh6ywszTEkEKdN7wbk8ajExBcEIp1HgSuuIrO/hjZb3uz/nQpfkXaoJaRovPMF3Kn7AHvlrITaJyvARpq1aKdPDiWgevwC/vjQFq88Q22Gp4v/6kqpzuQkdI4IcBqBO3Rnk8atRqHJhoTITjZcUiAOVdQqI= 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=jSWBods/; arc=none smtp.client-ip=209.85.218.53 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-ej1-f53.google.com with SMTP id a640c23a62f3a-a3db14a0a31so77399666b.2 for ; Thu, 15 Feb 2024 10:56:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708023366; x=1708628166; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4cAJLHNF/JRrCEO49lp/BKyIGOuJcZVH2wEu3LRWvvE=; b=jSWBods/dP4SiHbRd0cSkNnMRCO9007lj7/CUc9E/1xTONFWcPMaRtLunoJqBnsyAU NcecIXzihgi2FDUIu2o6wid3raLGPsT0DFAbc3YNUaO4uvtkAAKI9MX7saD593QjkdLf 0X3swW12Oo8hWlYqOqEhtbagBqEFXyvQ3eOvJzrodrIJ0RiRY6a1SeJcqBvgXyLCAgop ei5AN/+S2JmoGlKzILILfY75gE5ggA3KoFlrIJFoNBTjytw3nlosB7RlyJzJIvipK/7p rcdt8qwJkLzytiwrwYvhyPPbFlANyLPkEZQXkM74To6wyOntIGJEjNdJTQ27rtYgFfLf GOgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708023366; x=1708628166; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4cAJLHNF/JRrCEO49lp/BKyIGOuJcZVH2wEu3LRWvvE=; b=gB465csYj4AEf1qibayjTiHVGXL8QslLjzW71WzFWabWqZf6FO3/FIO7Eyd02N3fc/ nof4kDITPKGrW51IYh7oP3DQcJ8eUguRJ1lTyVWsB/J0LUThuAcpGm/wbVKY+X+H78uY 1TfSu3Xe6eY/cnG26aNIuC2YzAu7Px5+QG4ZH/WFh1PAIVrZr0yWn+ty2N1e9uQzjBDt mfGZTIM+EHNh8wubVMtVDizceUZoyoFrtWvg/kXJKZ9nKVKTYWr85YopY45KB8i+ba6S FfYY2dRFbxrmWEksKAPUU5a9JV4NUrPvJVw55LBkSCu5ivUK8jXV5rr3tLp5EaDYyxCT Djbg== X-Forwarded-Encrypted: i=1; AJvYcCWuEWUeOWql0CSx6Z9dEBJJTuN72/UuAnwi53jhN82zyfz/Rr9LAAYPNhSSp5rsvhm9iam/qutl6NlnV3i0s3kQVmucJDuC5uJdDs+f X-Gm-Message-State: AOJu0Yx+oK+cskvE6W+HgYh0nbBSl5ERt+VGTrFojJNW04nOEJortyHt BpzK6w/88IOn7KeQ9mhTgf+MFYyh+/v6d17Y/0SFs7HXR2mUY/qujzn3Zwq4F0Q= X-Received: by 2002:a17:906:1186:b0:a39:6c07:d31c with SMTP id n6-20020a170906118600b00a396c07d31cmr1969344eja.25.1708023366046; Thu, 15 Feb 2024 10:56:06 -0800 (PST) Received: from [192.168.0.22] ([78.10.207.130]) by smtp.gmail.com with ESMTPSA id tj6-20020a170907c24600b00a3dba44a709sm261960ejc.50.2024.02.15.10.56.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Feb 2024 10:56:05 -0800 (PST) Message-ID: <9c36b6e5-262d-48b1-971c-b03d9edf7789@linaro.org> Date: Thu, 15 Feb 2024 19:56:04 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 06/12] memory: stm32-fmc2-ebi: add RIF support Content-Language: en-US To: Christophe Kerello , miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, devicetree@vger.kernel.org References: <20240212174822.77734-1-christophe.kerello@foss.st.com> <20240212174822.77734-7-christophe.kerello@foss.st.com> <989661f0-f539-43c3-a332-13c0e99ed7b9@linaro.org> <1e1ae38b-7f8c-44ba-9970-0929aaaa28a8@linaro.org> From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1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FZkbLlqs2XpWaVCo2jv8+iHxZZ9FL7F6AHFzqEFdqGnJQqmEApiRqH6b4jRBOgJ+cY qc+rJggwMQcJL9F+oDm3wX47nr6jIsEB5ZftdybIzpMZ5V9v45lUwmdnMrSzZVgC4jRGXzsU EViBQt2CopXtHtYfPAO5nAkIvKSNp3jmGxZw4aTc5xoAZBLo0OV+Ezo71pg3AYvq0a3/oGRG KQ06ztUMRrj8eVtpImjsWCd0bDWRaaR4vqhCHvAG9iWXZu4qh3ipie2Y0oSJygcZT7H3UZxq fyYKiqEmRuqsvv6dcbblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 15/02/2024 10:00, Christophe Kerello wrote: > > > On 2/14/24 11:07, Krzysztof Kozlowski wrote: >> On 13/02/2024 14:15, Christophe Kerello wrote: >>>>> + >>>>> + if (ebi->majrev < FMC2_VERR_MAJREV_2) >>>>> + return 0; >>>>> + >>>>> + if (resource >= FMC2_MAX_RESOURCES) >>>>> + return -EINVAL; >>>>> + >>>>> + regmap_read(ebi->regmap, FMC2_SECCFGR, &seccfgr); >>> >>> Hi Krzysztof, >>> >>>> >>>> No checking of read value? >>>> >>> >>> No, it should never failed. >> >> And you tested that neither smatch, sparse nor Coverity report here >> warnings? >> > > Hi Krzysztof, > > There is a lot of driver in the Kernel that are using same > implementation, and I am surprised to not have had this comment 4 years > ago when the driver was introduced. Really? Care to give some pointers? Heh, I don't know what to respond to it. Either you say that my comment is incorrect or you say that it's okay to sneak poor code if no one notices? We can argue on the first, whether my comment is reasonable or not. But if you claim that previous poor choice of code is argument of bringing more of such poor choices, then we are done here. It's the oldest argument: someone did it that way, so I can do the same. Nope. > > So, how should I proceed? Shall I initialize all local variables used by > regmap_read? Or shall I check the return value of regmap_read? > And, as there is a lot of regmap_read call in this driver, shall I fix > them in a separate patch? regmap operations, depending on the regmap used, can fail. Most of the errors are result of static configuration, e.g. alignment, regmap in cache mode etc. Then certain regmap implementations can produce errors, which is not a static condition but dynamic. You have neither error checking nor value initialization. You risk here to have quite tricky to find, unnoticeable bugs, if there any mistake leading to regmap errors. Indeed neither smatch nor sparse report this as error currently, but maybe that's their limitation? Best regards, Krzysztof