Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3234009pxf; Mon, 22 Mar 2021 01:00:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzn2qegYp804ksD2kZySJhrc2eR279DdD2mHLESiJixJ+4qCDFziUqmSs65JpyXUEFgnjLl X-Received: by 2002:a17:906:1c41:: with SMTP id l1mr17854753ejg.299.1616400009280; Mon, 22 Mar 2021 01:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616400009; cv=none; d=google.com; s=arc-20160816; b=g1oT2JiFVgJIZ/DvQxO1HFu4LWsi4lM1sXvFo/t0vbPm84ncLbmGw9LmMcRqejlIj9 lCzx/E/qihpYfONTxtvcqUZBrGUUyxUw50PY2d5/oPu8CTOAUsdzHzIzqJJdWF010OU0 Rz63+a0BBVYtIaJmvfTmSoGsciMB6MABUODe/ulbPxY9XFFMkh5B72FXvrobQ+ATqkkI UcbyPlCvrtmSfZVVabyQ8V77sDDhgXywPKPX9ZZoBmd2W3u8gxRYepmxX9gjFDtbmriL pw23uzS77wB4tP6NZBCbZyaRJt32eKP+9R56w8SW/VLHmX826PkbVVz5aqZXL1FR5qWu wTSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=JczHixNLMGj+es6FQsJTPDKyju/gYUNcBlGk8mzUgzI=; b=e4W6fOGoQNPBzbTcW/r6L1RUOLokRlUdRMrAO6NN5eyBTBJ4SJOOijvaq7Nrvxt8Zb lL8z0F6dM4w+KsphW3w1rKzR4Vzt1svOgO6KFzlnclerZTkvhY7dlbVZd3YQ2ARiklEr oO06UthtYnx3TatTkHYw6kf/mp5p9nmfIbaJUQRNVtCIqKM5uDM7pSYSDMm5+n0lHe7v UZRpkzfo4F2AR9skbV4cMir8KIeVzIpbfH/Pqj6mdv1MAoBp6Br8bCkC9DBasMpCnXQ2 9HHFl9hAdJj1Va5631Yg53pVIoXeGaV35IlXB/p7zHPWkxoeLDP6r6FXHlcuCz75KSVK ANXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BWL4mbDo; 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 gv19si10687197ejc.109.2021.03.22.00.59.47; Mon, 22 Mar 2021 01:00:09 -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=BWL4mbDo; 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 S229874AbhCVH6y (ORCPT + 99 others); Mon, 22 Mar 2021 03:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbhCVH6W (ORCPT ); Mon, 22 Mar 2021 03:58:22 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F08EC061574; Mon, 22 Mar 2021 00:58:21 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id v4so15569125wrp.13; Mon, 22 Mar 2021 00:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JczHixNLMGj+es6FQsJTPDKyju/gYUNcBlGk8mzUgzI=; b=BWL4mbDoCPbbfrcLKVWe742Sf4A07uSbX4fxbgF1cDD6oup5/1WksuKn8NClA9AO2+ QioT6Y+pilkav3CsvyHHSrvy7hPNi5w4cH2iUxfV916967kZlYfck0b/+QMp+MzSUo6n rwJ+2sEHn2Bh1Wwfyp18mQskKqRT9nPAFmDxJMPA4pGoFQpdcUaY1pDDxvuTvNySWbY/ J+4LIo/abWbuE8j3nHlixJH/SQUf1VUdWVGY5E0h8f2yCr9zNhcELZ+6L9wm+faL24Fc mfEw6Jcdbmy7t74VH5refE9XxyJ8DjPQsWKBUunyDZw20dfXwct6ABA2O9yqDOwjWIeS a8dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JczHixNLMGj+es6FQsJTPDKyju/gYUNcBlGk8mzUgzI=; b=H9RHFSzvZFMRfEnCCKyzF/vW4J8OlKC1NuvRFNhl8xnUbUTneKI0B5pVO32elHo+Ei 4sGNU1sfIqXg5Jv4ifZbE/xGCuVBwVusQoHkH1knAWJlBEpH9D8wwkOoKIN/cD9wmvAh bmbZmJnaM58oNx+ZlQXsuYqYqlgea3RFGnNvZcRAWrtMV2l1ybvkmZ+XadWamB4910CS H+0760L2NvX5cuIHBnwSAyolrWWXcZ15vBMdY7oEUaOdXgdTXr9bhZUl8rXDY1PTS2D4 6PehBlqofhJS3YCbJGslYaCIdP3HNo1z79b5DBtTnYgaLLXj+XVRXAFaBssdE2SlW8Er POLg== X-Gm-Message-State: AOAM533+5Amz4WXQ3banhdJLRN4CvkEjNa71WEviI4ajCU3R58T9ggWe tF492InDHLL70ANdpY17iO0= X-Received: by 2002:adf:e0d1:: with SMTP id m17mr14475951wri.90.1616399899111; Mon, 22 Mar 2021 00:58:19 -0700 (PDT) Received: from localhost ([62.96.65.119]) by smtp.gmail.com with ESMTPSA id q4sm16007653wma.20.2021.03.22.00.58.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 00:58:17 -0700 (PDT) Date: Mon, 22 Mar 2021 08:58:35 +0100 From: Thierry Reding To: Sven Van Asbroeck Cc: Clemens Gruber , linux-pwm@vger.kernel.org, Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , Lee Jones , Linux Kernel Mailing List , Mika Westerberg , David Jander Subject: Re: [PATCH v5 1/7] pwm: pca9685: Switch to atomic API Message-ID: References: <20201215212228.185517-1-clemens.gruber@pqgruber.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="41IcEhGcM6XGCGcU" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.6 (98f8cb83) (2021-03-06) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --41IcEhGcM6XGCGcU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 17, 2020 at 12:10:10PM -0500, Sven Van Asbroeck wrote: > On Thu, Dec 17, 2020 at 11:48 AM Clemens Gruber > wrote: > > > > I can initialize the values to 0 of course and check the file for other > > places with missing initializations. > > > > Or would it be better to check the return codes of regmap_read/write in > > such cases? I'm not sure. >=20 > I think that checking the regmap_read/write return values is overkill > in this driver. These functions can't realistically fail, except if the i= 2c > bus is bad, i.e. h/w failure or intermittency. And that's an externality > which I believe we can ignore. I think there are (rare) occasions where it's fine to not check for errors, i.e. if you definitively know that calls can't fail. However, given that this uses regmap and you don't really know what's backing this, I think it's always better to err on the side of caution and properly check the return values. The fact that this can be externally caused is actually a reason why we shouldn't be ignoring any errors. If there's a chip that's hogging the I2C bus or if you've even just mistyped the I2C client's address in DT, it's better if the PWM driver tells you with an error message than if it is silently ignoring the errors and keeps you guessing at why the PWM isn't behaving the way it should. Granted, the error code isn't always going to pinpoint exactly what's going wrong, but for serious errors often the I2C bus driver will let you know with an extra error message. However, it's much easier to go looking for that error message if the PWM driver lets you know that something went wrong. Please just add full checking of regmap operations. Thierry --41IcEhGcM6XGCGcU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmBYTigACgkQ3SOs138+ s6EZZA/9HXIKvPJZRGitdRoOS8/DxFIp1cj14qpTGMCCTsWsPXNqQ6KrpZczn3Pk +3MlE3rvl6K9EDgNLDywsN5FaQ+HRJp7wdWUZOaH099uB/t+jIj4EDFU7WfzZYiO Lj4D2h21zYnKNqhzjb6Xukv36Ym4Xob01sa66N2LL/JoOCUBtvZrkcDFlO5fCuTO TAEklnpFdfYyYrOUXxe8EEnn6R4DUDQLnPiSPZvvG8xYd1gNFF2TEv1izR8Hc7sj x0cwQVyvEKd2tQC+TR+jQ2usw4slkpxleKhAdhUEGePk/Z+uthb01gzI/fGpJBC+ UQuwjX9Uu3McTfOu7pyl2M7ObDGrmelTcSioLewWYYryM2qNAV6hTaCgmi5P6boC FoRb5U39bkoSN77fFMbOi+/7Nr0pC1lMqdN4zWIFKF+zzZ6qUlntf33+CcF7VYYF bD9W845SbE4QMA/O8UM7PNPAToqjXQEBpnWFMX73g8Am4xs0hXRFtbgCtwy4bqGv qrQ4xLR5uuleZ7lZz1qKgd8YCvqNFosUZK0Eab3LLUy5hR2AFbzYfm4XY7/Kln9f gVE6eVcy7Qr+inPZfmJTM33RpxoA0bA4BVaPxx5KmI/C7PMLMSgar7yqVO2cPpQB sHVRrZKZM2UTUtAjD604mDa+BPUWsw7y0w32ZabvNcE1DJLy134= =n6By -----END PGP SIGNATURE----- --41IcEhGcM6XGCGcU--