Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935229AbdLRVmy (ORCPT ); Mon, 18 Dec 2017 16:42:54 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:36045 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933574AbdLRVmu (ORCPT ); Mon, 18 Dec 2017 16:42:50 -0500 Date: Mon, 18 Dec 2017 22:42:49 +0100 From: Alexandre Belloni To: Andreas Platschek Cc: linux-kernel@vger.kernel.org, a.zummo@towertech.it, linux-rtc@vger.kernel.org Subject: Re: [PATCH 1/2] rtc: omap: check for clk_prepare_enable() error Message-ID: <20171218214249.GA15162@piout.net> References: <20171206194238.12824-1-andreas.platschek@opentech.at> <20171206194238.12824-2-andreas.platschek@opentech.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171206194238.12824-2-andreas.platschek@opentech.at> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 985 Lines: 30 On 06/12/2017 at 20:42:37 +0100, Andreas Platschek wrote: > clk_prepare_enable() returns an error -> check it. > > Signed-off-by: Andreas Platschek > --- > drivers/rtc/rtc-omap.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c > index 1d666ac9ef70..ad309feb7d11 100644 > --- a/drivers/rtc/rtc-omap.c > +++ b/drivers/rtc/rtc-omap.c > @@ -748,8 +748,15 @@ static int omap_rtc_probe(struct platform_device *pdev) > else > rtc->clk = devm_clk_get(&pdev->dev, "int-clk"); > > - if (!IS_ERR(rtc->clk)) > - clk_prepare_enable(rtc->clk); > + if (!IS_ERR(rtc->clk)) { > + ret = clk_prepare_enable(rtc->clk); > + if (ret) { > + dev_err(&pdev->dev, > + "Failed to enable rtc clk (%u)\n", ret); As this will never fail, can we avoid having a useless string? -- Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com