Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2349495pxf; Sat, 27 Mar 2021 08:58:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQFlj+r0IBIfP9hge7AMJ/JY/wjlFv1ZPPzVD9mEXWVGECyvqJ/GSEvffum66Rywn9Jwh/ X-Received: by 2002:a05:6402:1004:: with SMTP id c4mr21029148edu.364.1616860723058; Sat, 27 Mar 2021 08:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616860723; cv=none; d=google.com; s=arc-20160816; b=QB0MFggi+9w/pz65S3sXrZEd6ozZmDaQyDqVPTo2bB2lkd76eTDfkXSMBiI5y6qKKJ Uk2fAtciEnc01EhTGL0vtc7+m8zvo4h+ZVIE/auBvEAj+tD6IO4APr8/jXktdKIg4GnB MhA/rW0Oi3XgFSvMjrm7rszxXKzNM4DGcj9RpWQedGw+1m+aLVgXcuUKV996159rlJXD 63NyiR1zc2ndgR9GXhkjUdos4UrRzxP2yzQH3kHNzVoFm1sZr22PoTsVBioOxFefhOtj b0ghKJQS3QwZmio1VHalFfHPVhfQKuM0PkSD94viHpTt75tUXQxC5//Jlvp2AKIhUs+u DNKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=U1/5mO9/pvifbFBvwKUxzTpOhHdjmuuw1LjJ30iSfIA=; b=IPhN5X7EHMEdoxkR/u1nljEZVgeX7MmQDiwhqfWtzhlla8PxRKRoRnWFd71cDteIQO z6nNFJkukKjVFyA8LVcE0inCIWMHDwxScTorat0/3O7hvN5rTxDbyOh4f5PZm3Gdby34 8Ak9cHOMLsRhkYZGcUrP3ZWwmZ4QTvxZPLZ+mlQiMNLPfGJIFEP7g51/M812FwzuDr2Y 9yFQnZlL9BoSsaFwSqwzwUTb8Im2omAQkOb8X5fAaZ9AqAE/NJBSA4wJ4t3wjNDbxTUY JDvZuPMW3dGBaf3AvwP9u6XAG6pKb7OQmZtzTwuxR10/icg3mye6HW8xoupyobNZ3KTB QcZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=CKcIdTgN; 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=REJECT sp=NONE dis=NONE) header.from=pqgruber.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bj22si1671737ejb.729.2021.03.27.08.58.18; Sat, 27 Mar 2021 08:58:43 -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=@pqgruber.com header.s=mail header.b=CKcIdTgN; 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=REJECT sp=NONE dis=NONE) header.from=pqgruber.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230178AbhC0PzO (ORCPT + 99 others); Sat, 27 Mar 2021 11:55:14 -0400 Received: from mail.pqgruber.com ([52.59.78.55]:52716 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229582AbhC0Pyw (ORCPT ); Sat, 27 Mar 2021 11:54:52 -0400 Received: from workstation.tuxnet (213-47-165-233.cable.dynamic.surfer.at [213.47.165.233]) by mail.pqgruber.com (Postfix) with ESMTPSA id D5828CB478B; Sat, 27 Mar 2021 16:54:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1616860489; bh=U1/5mO9/pvifbFBvwKUxzTpOhHdjmuuw1LjJ30iSfIA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CKcIdTgNnf59N9VMHw0m7We3VIpxLqea3+nr91l+J/DMGef0MRIFoUdzJT31hwbrx /s1xEfLrMT2FbJkaf89jiRpOC/uAjkQ0s6Zk3MG2aQrGZM1BmklZ12xKu0FWb/0/nY p/N0ykruPyO5NIuviR2ESTT2TbmuG5qhP82I+KAY= Date: Sat, 27 Mar 2021 16:54:47 +0100 From: Clemens Gruber To: Thierry Reding Cc: Sven Van Asbroeck , linux-pwm@vger.kernel.org, Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , 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: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thierry, On Mon, Mar 22, 2021 at 08:58:35AM +0100, Thierry Reding wrote: > 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. > > > > I think that checking the regmap_read/write return values is overkill > > in this driver. These functions can't realistically fail, except if the i2c > > 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. OK, I will create a separate patch adding these checks in the next series. This will lead to > 20 additional dev_err statements, let me know if I should instead just return the error code and not add dev_err's for every failed regmap operation. Clemens