The callers of iwl_drv_start() are probe functions. If a probe
function returns 0, it means it succeeded. So if NULL was returned by
iwl_drv_start(), it would be considered as a success.
Fix this by returning -ENOMEM if the driver struct allocation fails in
iwl_drv_start().
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
int ret;
drv = kzalloc(sizeof(*drv), GFP_KERNEL);
- if (!drv)
- return NULL;
+ if (!drv) {
+ ret = -ENOMEM;
+ goto err;
+ }
drv->trans = trans;
drv->dev = trans->dev;
err_free_drv:
#endif
kfree(drv);
-
+err:
return ERR_PTR(ret);
}
trans_pcie = IWL_TRANS_GET_PCIE_TRANS(iwl_trans);
trans_pcie->drv = iwl_drv_start(iwl_trans, cfg);
- if (IS_ERR_OR_NULL(trans_pcie->drv)) {
+ if (IS_ERR(trans_pcie->drv)) {
ret = PTR_ERR(trans_pcie->drv);
goto out_free_trans;
}