From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8DC4FEB64D9 for ; Tue, 27 Jun 2023 13:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S9R4jMi0u748O2XVvM3lx2oPZd2lBe4SRI0jbXgXWHI=; b=vlPtAquOme0/Cb ciTe0x8t5hta/5YNIPkwHyA9EIWZRgiGEFBginB+MaqemPwwrordD9IlZuXmIEetOio0qd5I09C7y khmGeqKNqqeuHNy9SK5AiHpsI1is0PTS4Oikh7CpofN25Bt8bstmeKmBw+ql+iH8pNKKmpYcti5wT dZjkQcCZrZ6J526mllgMWc7sbU3vt38Zj7Rcv5RVDDy3Yt/oHz1ZZDPAVkzv9zFbqYOQgAMDaVGqE ReBJu5ZlklITk6DlQi2UyN+frPInsgDIOsw7sV9Rc0XElZNBuo25QKApsd/c6ERimT0dVcKwSh0Wy yWSGcRjgUoM8GXKhHIKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qE8p0-00DHhK-1p; Tue, 27 Jun 2023 13:33:30 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qE8ox-00DHgk-26 for linux-arm-kernel@lists.infradead.org; Tue, 27 Jun 2023 13:33:29 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F1F7A6119D; Tue, 27 Jun 2023 13:33:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80EABC433C0; Tue, 27 Jun 2023 13:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687872806; bh=hU/bbFYDxlazJtaG0Aky+dV6lWTbtVrya1pQRCRiTcs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lRCpUOcgDLM5IsK6PYe4oGTEfki9RNeEaJeti5s+B+D2DmBrQJG24uumr+Qu+xnq9 NK6l4xpK09ScsXXxHQcm90Lqhi3L42FzaduuBHdCCOQ+haTaZcJP0wjd7ZjTiXBhsm Ybk9lkD8iWS9I3dH7WNi5wSyCSIVDzIcoqLgdfBeKBc2Kc/cJ5jO4XMF7BEAjIXqmq AIFPUm90kBWNf2B9XwWoZcHaSDC0rxHoAWpuyTa5LUCM7mNXRNbeFkcAjRNuinVUuR GMHVF+CmP8uEM7h1VoHpPQQro3bzpyAoKg9EpHhP6SpOVdTygQwFQ9oPXHr5mpcsOm B9uKvsSZic8CA== Date: Tue, 27 Jun 2023 15:33:22 +0200 From: Andi Shyti To: Dan Carpenter Cc: Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Wolfram Sang , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] i2c: sun6i-p2wi: Fix an error message in probe() Message-ID: <20230627133322.szotkthwsfwgkdby@intel.intel> References: <98afbc28-3366-459e-bd01-f77cf1a67fe9@moroto.mountain> <20230627115920.c4ms65vgrbiyekc6@intel.intel> <7c6db53c-427d-4ba5-80b7-a069ab9322a0@kadam.mountain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7c6db53c-427d-4ba5-80b7-a069ab9322a0@kadam.mountain> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230627_063327_779531_666FA796 X-CRM114-Status: GOOD ( 27.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Dan, On Tue, Jun 27, 2023 at 03:08:53PM +0300, Dan Carpenter wrote: > On Tue, Jun 27, 2023 at 01:59:20PM +0200, Andi Shyti wrote: > > Hi Dan, > > > > On Tue, Jun 27, 2023 at 10:12:36AM +0300, Dan Carpenter wrote: > > > The "ret" variable is uninitialized. It was the "p2wi->rstc" variable > > > that was intended. We can also use the %pe string format to print the > > > error code name instead of just the number. > > > > > > Fixes: 75ff8a340a81 ("i2c: sun6i-p2wi: Use devm_clk_get_enabled()") > > > Signed-off-by: Dan Carpenter > > > --- > > > drivers/i2c/busses/i2c-sun6i-p2wi.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/i2c/busses/i2c-sun6i-p2wi.c b/drivers/i2c/busses/i2c-sun6i-p2wi.c > > > index ad8270cdbd3e..fa6020dced59 100644 > > > --- a/drivers/i2c/busses/i2c-sun6i-p2wi.c > > > +++ b/drivers/i2c/busses/i2c-sun6i-p2wi.c > > > @@ -250,7 +250,8 @@ static int p2wi_probe(struct platform_device *pdev) > > > > > > p2wi->rstc = devm_reset_control_get_exclusive(dev, NULL); > > > if (IS_ERR(p2wi->rstc)) { > > > - dev_err(dev, "failed to retrieve reset controller: %d\n", ret); > > > + dev_err(dev, "failed to retrieve reset controller: %pe\n", > > > + p2wi->rstc); > > > > Yes, good catch! Thanks! But I think we want to print the error > > value here, so I think it should be: > > > > - dev_err(dev, "failed to retrieve reset controller: %d\n", ret); > > + dev_err(dev, "failed to retrieve reset controller: %d\n", > > + PTR_ERR(p2wi->rstc)); > > > > The %pe which I changed it to is a cool new thing that prints: > > failed to retrieve reset controller: -EINVAL\n oh... that's right! Sorry, I didn't know about it! Then, definitely: Reviewed-by: Andi Shyti > We should create a similar %e printk format that works for ints instead > of error pointers. But instead of that you have people who cast error > codes to pointers just to get the %pe functionality. And other people > who make suggestions (this is the catagory that I'm in) but are too lazy > to do the actual work. Ahaha... that's right! It's indeed a nice feature to have. Let me see if I manage to scratch a few hours out of my time. Andi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel