From: Cyril Bur > Sent: 11 August 2015 07:01 ... > You have a dilema with the use of ugly if (rc = foo()). I don't like it but > the > file is littered with it. > > Looks like the majority of uses in this file the conditional block is only > one line then it makes sense (or at least in terms of numbers of lines... fair > enough), however, if you have a conditional block spanning multiple lines, I > don't like. ... > > kfree(adapter); > > } > > > > -static struct cxl *cxl_alloc_adapter(struct pci_dev *dev) > > +static struct cxl *cxl_alloc_adapter(void) > > { > > struct cxl *adapter; > > + int rc; > > > > if (!(adapter = kzalloc(sizeof(struct cxl), GFP_KERNEL))) > > return NULL; > > > > - adapter->dev.parent = &dev->dev; > > - adapter->dev.release = cxl_release_adapter; > > - pci_set_drvdata(dev, adapter); > > spin_lock_init(&adapter->afu_list_lock); > > > > + if ((rc = cxl_alloc_adapter_nr(adapter))) > > Humf > > > + goto err1; > > + > > + if ((rc = dev_set_name(&adapter->dev, "card%i", adapter->adapter_num))) > > Humf > > + goto err2; > > + > > return adapter; > > + > > +err2: > > + cxl_remove_adapter_nr(adapter); > > +err1: > > + kfree(adapter); > > + return NULL; > > } ...
The function above doesn't even use the 'rc' value. David _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev