Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3173031imm; Sun, 14 Oct 2018 13:25:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV62sw6zovEwI695gIkZSWPICJHGKrUjIlE4OZBzX26gAS2FCH00+zdJ1sUDJc1s7r75SGNpi X-Received: by 2002:a63:f314:: with SMTP id l20-v6mr13130553pgh.407.1539548750578; Sun, 14 Oct 2018 13:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539548750; cv=none; d=google.com; s=arc-20160816; b=w8X+YMHoXi3nS0wYIKFOduNtOOZGvIOCPWunt22PodR/lhzjQLA2ZdNM19BeIiu2kW Z2NAi+H6RTIOIs4YHdTlbiLZJwt4ZrLq5N917TL50xvStNFh5bfg+goIXSpcEvAO+uXd xQPBtXXYM3qZjSpf3jNiira5/gO+bFP4W6wz+rhtb30kK6EqXGW1V3055oo+iRh+IG0v 6biEb8UHBzwVOtfGXe2piN80fm/0reV6igaabkPhdAp+svRJlxnWgAPQODXjccncAafm 8/56EUFrCAHcgiC65i784e6c3KQOmIB2xAAADjtFt6Fa5W14Eo+u4KNvkDIz/6n4HU60 0UMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=GsAp0WEw3FPtHFTQi576woYXV+Onv7GqlGxDSblLPvw=; b=b9Fzw2OuQw8MzXDcMooLKcl1o4D5oz7C96zA1hkMM69lx/M+DcAfrBot1coLeo2C+K fZ4IoLQoodCZ6gr0KjFTcJWyHZw7grRW13Y80ik5be6F8OSAbsRwML6udd+pQnRHP9fm rm2RFXhtWhfeL5UPNv/+2fv4mMcKIS4ftW70rkSg1U6p+AIjTqjjqxFyNf8cU0es1o+J c84xtjuez0MlzL1ceCNzupuS4Y2nitN7gJDE315hRmkcpvBkS0j1mIwmRGPRgUH4/TXY v+2yR2OacbyauHGZjILRlomb9rT0Un6i1Da4z8L04A9oNfZBUQNugwi1A4QTr0bCHBYp kluA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p126-v6si8674183pfp.234.2018.10.14.13.25.35; Sun, 14 Oct 2018 13:25:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbeJOEHO (ORCPT + 99 others); Mon, 15 Oct 2018 00:07:14 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:36473 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725722AbeJOEHO (ORCPT ); Mon, 15 Oct 2018 00:07:14 -0400 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gBmwd-0001ag-1m; Sun, 14 Oct 2018 22:24:59 +0200 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1gBmwb-0002ny-4g; Sun, 14 Oct 2018 22:24:57 +0200 Date: Sun, 14 Oct 2018 22:24:57 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: =?utf-8?B?Vm9rw6HEjQ==?= Michal Cc: Mark Rutland , "devicetree@vger.kernel.org" , "linux-pwm@vger.kernel.org" , Lukasz Majewski , "linux-kernel@vger.kernel.org" , Rob Herring , Thierry Reding , "kernel@pengutronix.de" , Fabio Estevam , Lothar =?iso-8859-1?Q?Wa=DFmann?= Subject: Re: =?iso-8859-1?B?W1JDRqBQQVRDSCx2Miwy?= =?iso-8859-1?B?LzJd?= pwm: imx: Configure output to GPIO in disabled state Message-ID: <20181014202457.dohwgz3frgcpdpy6@pengutronix.de> References: <1539163920-9442-3-git-send-email-michal.vokac@ysoft.com> <20181012085720.GA9451@taurus.defre.kleine-koenig.org> <20181012160854.hmgpokxgsrqdzobx@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181012160854.hmgpokxgsrqdzobx@pengutronix.de> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Fri, Oct 12, 2018 at 06:08:54PM +0200, Uwe Kleine-K?nig wrote: > > >> + if (PTR_ERR(imx_chip->pwm_gpiod) == -EPROBE_DEFER) { > > > > > > You must not use PTR_ERR on a value that might not contain an error > > > pointer. > > > > OK, thank you for valuable info. > > So it seems like the I2C folks are in troubles as well: > > > > https://elixir.bootlin.com/linux/latest/source/drivers/i2c/busses/i2c-imx.c#L996 > > correct. I cannot find this documented though. I found in LDD3[1], chapter 11 on page 295: If you need the actual error code, it can be extracted with: long PTR_ERR(const void *ptr); You should use PTR_ERR only on a value for which IS_ERR returns a true value; any other value is a valid pointer. That is probably where I have my claim from. There is no further explanation though, so I'll post a patch adding a comment to the definition of PTR_ERR to find out if there is a relevant reason. Best regards Uwe [1] https://lwn.net/Kernel/LDD3/ -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |