lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220119130845.6de245b8b217e659cd319328@hugovil.com>
Date:   Wed, 19 Jan 2022 13:08:45 -0500
From:   Hugo Villeneuve <hugo@...ovil.com>
To:     Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc:     Alessandro Zummo <a.zummo@...ertech.it>,
        Hugo Villeneuve <hvilleneuve@...onoff.com>,
        linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rtc: pcf2127: add error message if writing to CLKOUT
 register fails

On Wed, 19 Jan 2022 18:37:40 +0100
Alexandre Belloni <alexandre.belloni@...tlin.com> wrote:

> On 19/01/2022 12:27:39-0500, Hugo Villeneuve wrote:
> > From: Hugo Villeneuve <hvilleneuve@...onoff.com>
> > 
> > If writing to CLKOUT register fails, the probe operation will be aborted
> > without a meaningful error message.
> > 
> 
> The current trend is to remove debug messages, please do not add more :)

Hi,
If the read operation fails, the probe function will exit silently, and our RTC chip will not work. In that case, if we parse the dmesg logs, I think we  should have an indication that something went wrong.

I had a case where my dev board was not properly plugged-in, and before this patch, I didn't notice it because of the silent abort of the probe function.

> 
> > Signed-off-by: Hugo Villeneuve <hvilleneuve@...onoff.com>
> > ---
> >  drivers/rtc/rtc-pcf2127.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> > index 3d1f57e54372..823abe2a7147 100644
> > --- a/drivers/rtc/rtc-pcf2127.c
> > +++ b/drivers/rtc/rtc-pcf2127.c
> > @@ -717,8 +717,10 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
> >  	if (!(val & PCF2127_BIT_CLKOUT_OTPR)) {
> >  		ret = regmap_set_bits(pcf2127->regmap, PCF2127_REG_CLKOUT,
> >  				      PCF2127_BIT_CLKOUT_OTPR);
> > -		if (ret < 0)
> > +		if (ret < 0) {
> > +			dev_err(dev, "writing to CLKOUT register failed\n");
> >  			return ret;
> > +		}
> >  
> >  		msleep(100);
> >  	}
> > -- 
> > 2.30.2
> > 
> 
> -- 
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
> 


-- 
Hugo Villeneuve <hugo@...ovil.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ