Re: [PATCH v3 8/8] ACPI: property: Read buffer properties as integers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

On Wed, May 25, 2022 at 08:36:54PM +0300, Andy Shevchenko wrote:
> On Wed, May 25, 2022 at 04:01:23PM +0300, Sakari Ailus wrote:
> > Instead of adding a new property type, read buffer properties as integers.
> > Even though the internal representation in ACPI is different, the data
> > type is the same (byte) than on 8-bit integers.
> 
> ...
> 
> > +	switch (proptype) {
> > +	case DEV_PROP_STRING:
> > +		break;
> > +	case DEV_PROP_U8 ... DEV_PROP_U64:
> > +		if (obj->type == ACPI_TYPE_BUFFER) {
> 
> > +			if (nval <= obj->buffer.length)
> > +				break;
> > +			return -EOVERFLOW;
> 
> Why not traditional pattern and be consistent with default case?
> 
> 			if (nval > obj->buffer.length)
> 				return -EOVERFLOW;
> 			break;

Agreed.

> 
> > +		}
> > +		fallthrough;
> > +	default:
> > +		if (nval > obj->package.count)
> > +			return -EOVERFLOW;
> 
> I would add break statement here.

Sounds good.

-- 
Sakari Ailus



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux