On 11/9/22 11:41, Asutosh Das wrote:
+ /* Manually allocate MCQ resource from ufs_mem */
Manually -> explicitly? The meaning of "manually" is "by hand and not by machine". Software is always executed by a CPU (machine) so nothing happens manually in software.
+ ret = insert_resource(&iomem_resource, res_mcq); + if (ret) { + dev_err(hba->dev, "Failed to insert MCQ resource, err=%d\n", + ret); + devm_kfree(hba->dev, res_mcq); + return ret; + } + + res->base = devm_ioremap_resource(hba->dev, res_mcq); + if (IS_ERR(res->base)) { + dev_err(hba->dev, "MCQ registers mapping failed, err=%d\n", + (int)PTR_ERR(res->base)); + ret = PTR_ERR(res->base); + res->base = NULL; + remove_resource(res_mcq); + devm_kfree(hba->dev, res_mcq); + return ret; + }
I see duplicated code in error paths. Please move the code for freeing resources past the "return 0" statement and use goto statements to jump to that code in case of an error.
Thanks, Bart.