On 2022/7/13 18:14, Cheng Xu wrote: > > On 7/13/22 6:03 PM, Wenpeng Liang wrote: >> On 2022/7/13 17:36, Cheng Xu wrote: >>> On 7/13/22 5:26 PM, Wenpeng Liang wrote: >>> >>> <...> >>> >>>> +static int fmea_recover_others(struct hns_roce_dev *hr_dev, u32 res_type, >>>> + u32 index) >>>> +{ >>>> + u8 write_bt0_op = fmea_ram_res[res_type].write_bt0_op; >>>> + u8 read_bt0_op = fmea_ram_res[res_type].read_bt0_op; >>>> + struct hns_roce_cmd_mailbox *mailbox; >>>> + u64 addr; >>>> + int ret; >>>> + >>>> + mailbox = hns_roce_alloc_cmd_mailbox(hr_dev); >>>> + if (IS_ERR(mailbox)) >>>> + return PTR_ERR(mailbox); >>>> + >>>> + ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, read_bt0_op, index); >>>> + if (ret) { >>>> + dev_err(hr_dev->dev, >>>> + "failed to execute cmd to read fmea ram, ret = %d.\n", >>>> + ret); >>>> + goto err; >>>> + } >>>> + >>>> + addr = fmea_get_ram_res_addr(res_type, mailbox->buf); >>>> + >>>> + ret = hns_roce_cmd_mbox(hr_dev, addr, 0, write_bt0_op, index); >>>> + if (ret) { >>>> + dev_err(hr_dev->dev, >>>> + "failed to execute cmd to write fmea ram, ret = %d.\n", >>>> + ret); >>>> + goto err; >>>> + } >>>> + >>> Here it seems that you miss a "return 0" or the "goto err;" is unnecessary. >>> >> Will remove the "goto err;". >> > And, if the hns_roce_free_cmd_mailbox is called in both normal and error flow, > Maybe using "out" or some name else is better than "err" as the jump label? > Will fix it. Thansk, Wenpeng > Thanks, > Cheng Xu