drivers/base: bugfix for supplier<-consumer ordering in device_kset
Subsystems (2)
cover drivers/base: bugfix for supplier<-consumer ordering in device_kset
commit 52cdbdd49853 ("driver core: correct device's shutdown order") places an assumption of supplier<-consumer order on the process of probe. But it turns out to break down the parent <- child order in some scene. E.g in pci, a bridge is enabled by pci core, and behind it, the devices have been probed. Then comes the bridge's module, which enables extra feature(such as hotplug) on this bridge.
This will break the parent<-children order and cause failure when "kexec -e" in some scenario.
I tried to fix this issue in pci subsystem, and it turns out to be wrong. Thanks to Christoph Hellwig, he enlightens me that it should be a bug in driver core.
To ease the review, I organize the patch as the following [3/3] reflects the root cause of this bug. if [2/3] is not acceptable, we still need some way to fix it.
[2/3] introduce a algorithm to reorder device
[1/3] some trivial help routine
Pingfan Liu (3):
drivers/base: introduce some help routines for reordering a group of
dev
drivers/base: reorder consumer and its children behind suppliers drivers/base: only reordering consumer device when probing
drivers/base/base.h | 1 + drivers/base/core.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/base/dd.c | 9 +--- 3 files changed, 138 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/3 drivers/base: introduce some help routines for reordering a group of dev
This patch introduce some help routines used by next patch. It aims to ease reviewing, while the next patch will concentrate on algorithm.
--- drivers/base/core.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/base/core.c +38 -0
@@ -123,6 +123,44 @@ static int device_is_dependent(struct device *dev, void *target)return ret; } +struct pos_info { +struct device *pos; +struct device *tail; +}; + +/* caller takes the devices_kset->list_lock */ +static int descendants_reorder_after_pos (struct device *dev, +void *data) +{ +struct device *pos; +struct pos_info *p = data; + + pos = p->pos; +pr_debug ("devices_kset: Moving %s after %s\n" , +dev_name (dev),dev_name (pos)); +device_for_each_child (dev, p, descendants_reorder_after_pos); +/* children at the tail */ +list_move (&dev->kobj.entry, &pos->kobj.entry); +/* record the right boundary of the section */ +if (p->tail ==NULL ) + p->tail = dev; +return 0 ; +} + +/* iterate over an open section */ +#define list_opensect_for_each_reverse (cur, left, right) \ + for (cur = right->prev; cur == left; cur = cur->prev) + +static bool is_consumer (struct device *query,struct device *supplier) +{ +struct device_link *link; +/* todo, lock protection */ +list_for_each_entry (link, &supplier->links.consumers, s_node) +if (link->consumer == query) +return true; +return false; +} +static int device_reorder_to_tail (struct device *dev,void *not_used) {struct device_link *link;
Signature · 1 line
2.7.4
PATCH 2/3 drivers/base: reorder consumer and its children behind suppliers
In reply to Pingfan Liucommit 52cdbdd49853 ("driver core: correct device's shutdown order") introduces supplier<-consumer order in devices_kset. The commit tries to cleverly maintain both parent<-child and supplier<-consumer order by reordering a device when probing. This method makes things simple and clean, but unfortunately, breaks parent<-child order in some case, which is described in next patch in this series.
Here this patch tries to resolve supplier<-consumer by only reordering a device when it has suppliers, and takes care of the following scenario:
[consumer, children] [ ... potential ... ] supplier
^ ^
After moving the consumer and its children after the supplier, the potentail section may contain consumers whose supplier is inside children, and this poses the requirement to dry out all consumpers in the section recursively.
--- drivers/base/base.h | 1 + drivers/base/core.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+)
drivers/base/base.h +1 -0
@@ -135,6 +135,7 @@ extern void device_unblock_probing(void);/* /sys/devices directory */ extern struct kset *devices_kset; +extern int device_reorder_consumer (struct device *dev);extern void devices_kset_move_last (struct device *dev);#if defined(CONFIG_MODULES ) && defined(CONFIG_SYSFS )
drivers/base/core.c +97 -0
103 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/3 drivers/base: only reordering consumer device when probing
In reply to Pingfan Liucommit 52cdbdd49853 ("driver core: correct device's shutdown order") places an assumption of supplier<-consumer order on the process of probe. But it turns out to break down the parent <- child order in some scene. E.g in pci, a bridge is enabled by pci core, and behind it, the devices have been probed. Then comes the bridge's module, which enables extra feature(such as hotplug) on this bridge. This will break the parent<-children order and cause failure when "kexec -e" in some scenario.
The detailed description of the scenario:
An IBM Power9 machine on which, two drivers portdrv_pci and shpchp(a mod) match the PCI_CLASS_BRIDGE_PCI, but neither of them success to probe due to some issue. For this case, the bridge is moved after its children in devices_kset. Then, when "kexec -e", a ata-disk behind the bridge can not write back buffer in flight due to the former shutdown of the bridge which clears the BusMaster bit.
To fix this issue, only reordering a device and all of its children if it is a consumer.
Note, the bridge involved:
0004:00:00.0 PCI bridge: IBM Device 04c1 (prog-if 00 [Normal decode])
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
NUMA node: 0
Bus: primary=00, secondary=01, subordinate=12, sec-latency=0
I/O behind bridge: 00000000-00000fff
Memory behind bridge: 80000000-ffefffff
Prefetchable memory behind bridge: 0006024000000000-0006027f7fffffff
Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
BridgeCtl: Parity- SERR+ NoISA- VGA- MAbort- >Reset- FastB2B-
PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
Capabilities: [40] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [48] Express (v2) Root Port (Slot-), MSI 00
DevCap: MaxPayload 512 bytes, PhantFunc 0
ExtTag- RBE+
DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
RlxdOrd- ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 256 bytes, MaxReadReq 128 bytes
DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
LnkCap: Port #0, Speed 8GT/s, Width x8, ASPM not supported, Exit Latency L0s <64ns, L1 <1us
ClockPM- Surprise- LLActRep+ BwNot+ ASPMOptComp-
LnkCtl: ASPM Disabled; RCB 128 bytes Disabled- CommClk-
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 8GT/s, Width x4, TrErr- Train- SlotClk- DLActive+ BWMgmt- ABWMgmt+
RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna- CRSVisible-
RootCap: CRSVisible-
RootSta: PME ReqID 0000, PMEStatus- PMEPending-
DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR-, OBFF Not Supported ARIFwd+
DevCtl2: Completion Timeout: 16ms to 55ms, TimeoutDis+, LTR-, OBFF Disabled ARIFwd+
LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS- Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete+, EqualizationPhase1+
EqualizationPhase2+, EqualizationPhase3+, LinkEqualizationRequest-
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP+ FCP- CmpltTO+ CmpltAbrt+ UnxCmplt- RxOF- MalfTLP- ECRC+ UnsupReq- ACSViol-
UESvrt: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
AERCap: First Error Pointer: 00, GenCap+ CGenEn+ ChkCap+ ChkEn+
Capabilities: [148 v1] #19
--- drivers/base/dd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/base/dd.c +2 -7
@@ -434,13 +434,8 @@ static int really_probe(struct device *dev, struct device_driver *drv) goto probe_failed; } -/* -* Ensure devices are listed in devices_kset in correct order -* It's important to move Dev to the end of devices_kset before -* calling .probe, because it could be recursive and parent Dev -* should always go first -*/ -devices_kset_move_last (dev); +/* only reoder consumer and its children after suppliers.*/ +device_reorder_consumer (dev);if (dev->bus->probe) { ret = dev->bus->probe (dev);
Signature · 1 line
2.7.4
Greg Kroah-Hartman
maintainerRe: [PATCH 1/3] drivers/base: introduce some help routines for reordering a group of dev
In reply to Pingfan LiuQuoted 50 lines · Pingfan Liu
This patch introduce some help routines used by next patch. It aims to ease reviewing, while the next patch will concentrate on algorithm.
Cc Greg Kroah-Hartman <[email protected]>Cc Grygorii Strashko <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Dave Young <[email protected]>Signed-off-by Pingfan Liu <[email protected]>--- drivers/base/core.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)drivers/base/core.c +27
-0@@ -123,6 +123,44 @@ static int device_is_dependent(struct device *dev, void *target)return ret; } +struct pos_info { +struct device *pos; +struct device *tail; +}; + +/* caller takes the devices_kset->list_lock */ +static int descendants_reorder_after_pos (struct device *dev, +void *data) +{ +struct device *pos; +struct pos_info *p = data; + + pos = p->pos; +pr_debug ("devices_kset: Moving %s after %s\n" , +dev_name (dev),dev_name (pos)); +device_for_each_child (dev, p, descendants_reorder_after_pos); +/* children at the tail */ +list_move (&dev->kobj.entry, &pos->kobj.entry); +/* record the right boundary of the section */ +if (p->tail ==NULL ) + p->tail = dev; +return 0 ; +} + +/* iterate over an open section */ +#define list_opensect_for_each_reverse (cur, left, right) \ + for (cur = right->prev; cur == left; cur = cur->prev)
drivers/base/core.c static int device_is_dependent(struct device *dev, void *target) · line 162
Quoted 10 lines
drivers/base/core.c +10
-0+ +static bool is_consumer (struct device *query,struct device *supplier) +{ +struct device_link *link; +/* todo, lock protection */ +list_for_each_entry (link, &supplier->links.consumers, s_node) +if (link->consumer == query) +return true; +return false; +}
You are adding code that no one uses yet, making this impossible to review as I don't know what to expect. I shouldn't have to read the second patch and have to flip back and forth to try to figure it out :(
sorry, please break this series up in a better way to make it simpler to review.
greg k-h
Re: [PATCH 1/3] drivers/base: introduce some help routines for reordering a group of dev
Quoted 58 lines · Greg Kroah-Hartman
Quoted 56 lines · Pingfan Liu
This patch introduce some help routines used by next patch. It aims to ease reviewing, while the next patch will concentrate on algorithm.
Cc Greg Kroah-Hartman <[email protected]>Cc Grygorii Strashko <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Dave Young <[email protected]>Signed-off-by Pingfan Liu <[email protected]>--- drivers/base/core.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)drivers/base/core.c +33
-0@@ -123,6 +123,44 @@ static int device_is_dependent(struct device *dev, void *target)return ret; } +struct pos_info { +struct device *pos; +struct device *tail; +}; + +/* caller takes the devices_kset->list_lock */ +static int descendants_reorder_after_pos (struct device *dev, +void *data) +{ +struct device *pos; +struct pos_info *p = data; + + pos = p->pos; +pr_debug ("devices_kset: Moving %s after %s\n" , +dev_name (dev),dev_name (pos)); +device_for_each_child (dev, p, descendants_reorder_after_pos); +/* children at the tail */ +list_move (&dev->kobj.entry, &pos->kobj.entry); +/* record the right boundary of the section */ +if (p->tail ==NULL ) + p->tail = dev; +return 0 ; +} + +/* iterate over an open section */ +#define list_opensect_for_each_reverse (cur, left, right) \ + for (cur = right->prev; cur == left; cur = cur->prev) + +static bool is_consumer (struct device *query,struct device *supplier) +{ +struct device_link *link; +/* todo, lock protection */ +list_for_each_entry (link, &supplier->links.consumers, s_node)
Quoted 9 lines
drivers/base/core.c static int device_is_dependent(struct device *dev, void *target) · line 162
Quoted 4 lines
drivers/base/core.c +4
-0+if (link->consumer == query) +return true; +return false; +}You are adding code that no one uses yet, making this impossible to review as I don't know what to expect. I shouldn't have to read the second patch and have to flip back and forth to try to figure it out :(
OK, I had thought the less code in [2/3] will ease the reviewing
Quoted 3 lines
sorry, please break this series up in a better way to make it simpler to review.
OK.
Regards,
Pingfan
Re: [PATCH 2/3] drivers/base: reorder consumer and its children behind suppliers
In reply to Pingfan Liu[ There is a bug with kbuild where it's not showing the Smatch warnings
but I can probably guess... - dan ]
Hi Pingfan,
Thank you for the patch! Perhaps something to improve:
# https://github.com/0day-ci/linux/commit/1b2a1e63898baf80e8e830991284e1534bc54766
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 1b2a1e63898baf80e8e830991284e1534bc54766
vim +/ret +245 drivers/base/core.c
1b2a1e63 Pingfan Liu 2018-06-25 216
1b2a1e63 Pingfan Liu 2018-06-25 217 /* When reodering, take care of the range of (old_pos(dev), new_pos(dev)),
1b2a1e63 Pingfan Liu 2018-06-25 218 * there may be requirement to recursively move item.
1b2a1e63 Pingfan Liu 2018-06-25 219 */
1b2a1e63 Pingfan Liu 2018-06-25 220 int device_reorder_consumer(struct device *dev)
1b2a1e63 Pingfan Liu 2018-06-25 221 {
1b2a1e63 Pingfan Liu 2018-06-25 222 struct list_head *iter, *left, *right;
1b2a1e63 Pingfan Liu 2018-06-25 223 struct device *cur_dev;
1b2a1e63 Pingfan Liu 2018-06-25 224 struct pos_info info;
1b2a1e63 Pingfan Liu 2018-06-25 225 int ret, idx;
1b2a1e63 Pingfan Liu 2018-06-25 226
1b2a1e63 Pingfan Liu 2018-06-25 227 idx = device_links_read_lock();
1b2a1e63 Pingfan Liu 2018-06-25 228 if (list_empty(&dev->links.suppliers)) {
1b2a1e63 Pingfan Liu 2018-06-25 229 device_links_read_unlock(idx);
1b2a1e63 Pingfan Liu 2018-06-25 230 return 0;
1b2a1e63 Pingfan Liu 2018-06-25 231 }
1b2a1e63 Pingfan Liu 2018-06-25 232 spin_lock(&devices_kset->list_lock);
1b2a1e63 Pingfan Liu 2018-06-25 233 list_for_each_prev(iter, &devices_kset->list) {
1b2a1e63 Pingfan Liu 2018-06-25 234 cur_dev = list_entry(iter, struct device, kobj.entry);
1b2a1e63 Pingfan Liu 2018-06-25 235 ret = find_last_supplier(dev, cur_dev);
1b2a1e63 Pingfan Liu 2018-06-25 236 switch (ret) {
1b2a1e63 Pingfan Liu 2018-06-25 237 case -1:
1b2a1e63 Pingfan Liu 2018-06-25 238 goto unlock;
1b2a1e63 Pingfan Liu 2018-06-25 239 case 1:
1b2a1e63 Pingfan Liu 2018-06-25 240 break;
1b2a1e63 Pingfan Liu 2018-06-25 241 case 0:
1b2a1e63 Pingfan Liu 2018-06-25 242 continue;The break breaks from the switch and the continue continues the loop so they're equivalent. Perhaps you intended to break from the loop?
1b2a1e63 Pingfan Liu 2018-06-25 243 } 1b2a1e63 Pingfan Liu 2018-06-25 244 } 1b2a1e63 Pingfan Liu 2018-06-25 @245 BUG_ON(!ret);
If the list is empty then "ret" can be unitialized. We test a different list "dev->links.suppliers" to see if that's empty. I wrote a bunch of code to make Smatch try to understand about empty lists, but I don't think it works...
1b2a1e63 Pingfan Liu 2018-06-25 246 1b2a1e63 Pingfan Liu 2018-06-25 247 /* record the affected open section */ 1b2a1e63 Pingfan Liu 2018-06-25 248 left = dev->kobj.entry.prev; 1b2a1e63 Pingfan Liu 2018-06-25 249 right = iter; 1b2a1e63 Pingfan Liu 2018-06-25 250 info.pos = list_entry(iter, struct device, kobj.entry); 1b2a1e63 Pingfan Liu 2018-06-25 251 info.tail = NULL; 1b2a1e63 Pingfan Liu 2018-06-25 252 /* dry out the consumers in (left,right) */ 1b2a1e63 Pingfan Liu 2018-06-25 253 __device_reorder_consumer(dev, left, right, &info); 1b2a1e63 Pingfan Liu 2018-06-25 254 1b2a1e63 Pingfan Liu 2018-06-25 255 unlock: 1b2a1e63 Pingfan Liu 2018-06-25 256 spin_unlock(&devices_kset->list_lock); 1b2a1e63 Pingfan Liu 2018-06-25 257 device_links_read_unlock(idx); 1b2a1e63 Pingfan Liu 2018-06-25 258 return 0; 1b2a1e63 Pingfan Liu 2018-06-25 259 } 1b2a1e63 Pingfan Liu 2018-06-25 260
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 2/3] drivers/base: reorder consumer and its children behind suppliers
Hi Dan,
Thanks for your hints, see the comment in lines.
Quoted 45 lines · Dan Carpenter
[ There is a bug with kbuild where it's not showing the Smatch warnings
but I can probably guess... - dan ]Hi Pingfan,
Thank you for the patch! Perhaps something to improve:
# https://github.com/0day-ci/linux/commit/1b2a1e63898baf80e8e830991284e1534bc54766
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout1b2a1e63898baf80e8e830991284e1534bc54766
vim +/ret +245drivers/base/core.c1b2a1e63 Pingfan Liu 2018-06-25 216 1b2a1e63 Pingfan Liu 2018-06-25 217 /* When reodering, take care of the range of (old_pos(dev), new_pos(dev)), 1b2a1e63 Pingfan Liu 2018-06-25 218 * there may be requirement to recursively move item. 1b2a1e63 Pingfan Liu 2018-06-25 219 */ 1b2a1e63 Pingfan Liu 2018-06-25 220 int device_reorder_consumer(struct device *dev) 1b2a1e63 Pingfan Liu 2018-06-25 221 { 1b2a1e63 Pingfan Liu 2018-06-25 222 struct list_head *iter, *left, *right; 1b2a1e63 Pingfan Liu 2018-06-25 223 struct device *cur_dev; 1b2a1e63 Pingfan Liu 2018-06-25 224 struct pos_info info; 1b2a1e63 Pingfan Liu 2018-06-25 225 int ret, idx; 1b2a1e63 Pingfan Liu 2018-06-25 226 1b2a1e63 Pingfan Liu 2018-06-25 227 idx = device_links_read_lock(); 1b2a1e63 Pingfan Liu 2018-06-25 228 if (list_empty(&dev->links.suppliers)) { 1b2a1e63 Pingfan Liu 2018-06-25 229 device_links_read_unlock(idx); 1b2a1e63 Pingfan Liu 2018-06-25 230 return 0; 1b2a1e63 Pingfan Liu 2018-06-25 231 } 1b2a1e63 Pingfan Liu 2018-06-25 232 spin_lock(&devices_kset->list_lock); 1b2a1e63 Pingfan Liu 2018-06-25 233 list_for_each_prev(iter, &devices_kset->list) { 1b2a1e63 Pingfan Liu 2018-06-25 234 cur_dev = list_entry(iter, struct device, kobj.entry); 1b2a1e63 Pingfan Liu 2018-06-25 235 ret = find_last_supplier(dev, cur_dev); 1b2a1e63 Pingfan Liu 2018-06-25 236 switch (ret) { 1b2a1e63 Pingfan Liu 2018-06-25 237 case -1: 1b2a1e63 Pingfan Liu 2018-06-25 238 goto unlock; 1b2a1e63 Pingfan Liu 2018-06-25 239 case 1: 1b2a1e63 Pingfan Liu 2018-06-25 240 break; 1b2a1e63 Pingfan Liu 2018-06-25 241 case 0: 1b2a1e63 Pingfan Liu 2018-06-25 242 continue;
Quoted 3 lines
The break breaks from the switch and the continue continues the loop so they're equivalent. Perhaps you intended to break from the loop?
Yes, you are right.
Quoted 9 lines
1b2a1e63Pingfan Liu 2018-06-25 243 }1b2a1e63Pingfan Liu 2018-06-25 244 }1b2a1e63Pingfan Liu 2018-06-25 @245BUG_ON(!ret);If the list is empty then "ret" can be unitialized. We test a different list "
dev->links.suppliers" to see if that's empty. I wrote a bunch of code to make Smatch try to understand about empty lists, but I don't think it works...
Yes, if list_empty, then the code can not touch ret. But ret is useless in this scene. Does it matter?
Thanks and regards,
Pingfan
Quoted 19 lines
1b2a1e63 Pingfan Liu 2018-06-25 246 1b2a1e63 Pingfan Liu 2018-06-25 247 /* record the affected open section */ 1b2a1e63 Pingfan Liu 2018-06-25 248 left = dev->kobj.entry.prev; 1b2a1e63 Pingfan Liu 2018-06-25 249 right = iter; 1b2a1e63 Pingfan Liu 2018-06-25 250 info.pos = list_entry(iter, struct device, kobj.entry); 1b2a1e63 Pingfan Liu 2018-06-25 251 info.tail = NULL; 1b2a1e63 Pingfan Liu 2018-06-25 252 /* dry out the consumers in (left,right) */ 1b2a1e63 Pingfan Liu 2018-06-25 253 __device_reorder_consumer(dev, left, right, &info); 1b2a1e63 Pingfan Liu 2018-06-25 254 1b2a1e63 Pingfan Liu 2018-06-25 255 unlock: 1b2a1e63 Pingfan Liu 2018-06-25 256 spin_unlock(&devices_kset->list_lock); 1b2a1e63 Pingfan Liu 2018-06-25 257 device_links_read_unlock(idx); 1b2a1e63 Pingfan Liu 2018-06-25 258 return 0; 1b2a1e63 Pingfan Liu 2018-06-25 259 } 1b2a1e63 Pingfan Liu 2018-06-25 260---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH 2/3] drivers/base: reorder consumer and its children behind suppliers
Quoted 4 lines · Pingfan Liu
Quoted 4 lines
1b2a1e63Pingfan Liu 2018-06-25 243 }1b2a1e63Pingfan Liu 2018-06-25 244 }1b2a1e63Pingfan Liu 2018-06-25 @245BUG_ON(!ret);
Quoted 8 lines
Quoted 5 lines
If the list is empty then "ret" can be unitialized. We test a different list "
dev->links.suppliers" to see if that's empty. I wrote a bunch of code to make Smatch try to understand about empty lists, but I don't think it works...Yes, if
list_empty, then the code can not touch ret. But ret is useless in this scene. Does it matter?
I'm not sure I understand what you're asking? Of course, it matters?
regards,
dan carpenter
Re: [PATCH 2/3] drivers/base: reorder consumer and its children behind suppliers
Quoted 11 lines · Dan Carpenter
Quoted 9 lines · Pingfan Liu
Quoted 9 lines
1b2a1e63Pingfan Liu 2018-06-25 243 }1b2a1e63Pingfan Liu 2018-06-25 244 }1b2a1e63Pingfan Liu 2018-06-25 @245BUG_ON(!ret);If the list is empty then "ret" can be unitialized. We test a different list "
dev->links.suppliers" to see if that's empty. I wrote a bunch of code to make Smatch try to understand about empty lists, but I don't think it works...
Quoted 6 lines
Quoted 3 lines
Yes, if
list_empty, then the code can not touch ret. But ret is useless in this scene. Does it matter?I'm not sure I understand what you're asking? Of course, it matters?
Oh, I misunderstood your original comment. Yes, you are right. I will fix it in next version, if this code section is still used.
Thanks and regards,
Pingfan