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:
 <OS8PR06MB7541A23130F469357B7FE5F4F28B2@OS8PR06MB7541.apcprd06.prod.outlook.com>
Date: Mon, 26 Aug 2024 07:50:24 +0000
From: Ryan Chen <ryan_chen@...eedtech.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC: "brendan.higgins@...ux.dev" <brendan.higgins@...ux.dev>,
	"benh@...nel.crashing.org" <benh@...nel.crashing.org>, "joel@....id.au"
	<joel@....id.au>, "andi.shyti@...nel.org" <andi.shyti@...nel.org>,
	"robh@...nel.org" <robh@...nel.org>, "krzk+dt@...nel.org"
	<krzk+dt@...nel.org>, "conor+dt@...nel.org" <conor+dt@...nel.org>,
	"andrew@...econstruct.com.au" <andrew@...econstruct.com.au>,
	"p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
	"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
	"openbmc@...ts.ozlabs.org" <openbmc@...ts.ozlabs.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-aspeed@...ts.ozlabs.org"
	<linux-aspeed@...ts.ozlabs.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v13 2/3] i2c: aspeed: support AST2600 i2c new register
 mode driver

> Subject: Re: [PATCH v13 2/3] i2c: aspeed: support AST2600 i2c new register
> mode driver
> 
> On Fri, Aug 23, 2024 at 06:23:54AM +0000, Ryan Chen wrote:
> > > On Thu, Aug 22, 2024 at 02:24:26AM +0000, Ryan Chen wrote:
> > > > > On Wed, Aug 21, 2024 at 06:43:01AM +0000, Ryan Chen wrote:
> > > > > > > On Mon, Aug 19, 2024 at 05:28:49PM +0800, Ryan Chen wrote:
> 
> ...
> 
> > > > > > > > +	if (i2c_bus->mode == BUFF_MODE) {
> > > > > > > > +		i2c_bus->buf_base =
> > > > > > > devm_platform_get_and_ioremap_resource(pdev, 1, &res);
> > > > > > > > +		if (!IS_ERR_OR_NULL(i2c_bus->buf_base))
> > > > > > > > +			i2c_bus->buf_size = resource_size(res) / 2;
> > > > > > > > +		else
> > > > > > > > +			i2c_bus->mode = BYTE_MODE;
> > > > > > >
> > > > > > > What's wrong with positive conditional? And is it even
> > > > > > > possible to have NULL here?
> > > > > > >
> > > > > > Yes, if dtsi fill not following yaml example have reg 1, that
> > > > > > will failure at buffer
> > > > > mode.
> > > > > > And I can swith to byte mode.
> > > > > >
> > > > > > reg = <0x80 0x80>, <0xc00 0x20>;
> > > > >
> > > > > I was asking about if (!IS_ERR_OR_NULL(...)) line:
> > > > > 1) Why 'if (!foo) {} else {}' instead of 'if (foo) {} else {}'?
> > > > I will update to following.
> > > > 		if (IS_ERR(i2c_bus->buf_base))
> > > > 			i2c_bus->mode = BYTE_MODE;
> > > > 		else
> > > > 			i2c_bus->buf_size = resource_size(res) / 2;
> > > >
> > > > > 2) Why _NULL?
> > > > 	If dtsi file is claim only 1 reg offset. reg = <0x80 0x80>; that
> > > > will goto byte
> > > mode.
> > > > 	reg = <0x80 0x80>, <0xc00 0x20>; can support buffer mode.
> > > > 	due to 2nd is buffer register offset.
> > >
> > > I have asked why IS_ERR_OR_NULL() and not IS_ERR().
> > >
> > OH, I will doing by this.
> > 		if (IS_ERR_OR_NULL(i2c_bus->buf_base))
> 
> The question about _NULL remains unanswered...
Sorry, I may not catch your point.
So, Do you mean I should passive coding by following?

If (i2c_bus->buf_base > 0)
	i2c_bus->buf_size = resource_size(res) / 2;
else
    i2c_bus->mode = BYTE_MODE;

> 
> > 			i2c_bus->mode = BYTE_MODE;
> > 		else
> > 			i2c_bus->buf_size = resource_size(res) / 2;
> 
> --
> With Best Regards,
> Andy Shevchenko
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ