[PATCH] firmware: mediatek: Use dev_err_probe() to simplify code

Allen-KH Cheng (程冠勳) Allen-KH.Cheng at mediatek.com
Mon Sep 26 03:56:24 PDT 2022


Hi Yuan,

The patches LGTM:
Acked-by: Allen-KH Cheng <allen-kh.cheng at mediatek.com>

Thanks,
Allen

On Sat, 2022-09-24 at 02:43 +0000, Yuan Can wrote:
> In the probe path, dev_err() can be replaced with dev_err_probe()
> which will check if error code is -EPROBE_DEFER and prints the
> error name. It also sets the defer probe reason which can be
> checked later through debugfs.
> 
> Signed-off-by: Yuan Can <yuancan at huawei.com>
> ---
>  drivers/firmware/mtk-adsp-ipc.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/firmware/mtk-adsp-ipc.c b/drivers/firmware/mtk-
> adsp-ipc.c
> index 3c071f814455..c57880949521 100644
> --- a/drivers/firmware/mtk-adsp-ipc.c
> +++ b/drivers/firmware/mtk-adsp-ipc.c
> @@ -96,10 +96,9 @@ static int mtk_adsp_ipc_probe(struct
> platform_device *pdev)
>  		adsp_chan->idx = i;
>  		adsp_chan->ch = mbox_request_channel_byname(cl,
> adsp_mbox_ch_names[i]);
>  		if (IS_ERR(adsp_chan->ch)) {
> -			ret = PTR_ERR(adsp_chan->ch);
> -			if (ret != -EPROBE_DEFER)
> -				dev_err(dev, "Failed to request mbox
> chan %s ret %d\n",
> -					adsp_mbox_ch_names[i], ret);
> +			ret = dev_err_probe(dev, PTR_ERR(adsp_chan-
> >ch),
> +					    "Failed to request mbox
> chan %s\n",
> +					    adsp_mbox_ch_names[i]);
>  
>  			for (j = 0; j < i; j++) {
>  				adsp_chan = &adsp_ipc->chans[j];


More information about the linux-arm-kernel mailing list