Re: [PATCH 5/7] media: camss: Add regulator_bulk support

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

 



On 07/01/2022 19:52, Bjorn Andersson wrote:
When res->regulators is empty num_supplies will be 0 and you will get
ZERO_SIZE_PTR back here, so this works just fine - but I had to read the
code to learn what kzalloc(0) returns.

Literally as soon as I hit send I realised I hadn't tested the NULL case, then did test it and found this behavior.

Perhaps it would be nice to be explicit and make the allocation
conditional on num_supplies? And leave csid->supplies NULL when this
happens?

I'll rewrite it, agreed its confusing to look at.

---
bod



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux