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

Cristian Marussi cristian.marussi at arm.com
Mon Sep 26 03:50:26 PDT 2022


On Sat, Sep 24, 2022 at 02:51:46AM +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>

Hi Yuan,

LGTM, thanks for this.

Reviewed-by: Cristian Marussi <cristian.marussi at arm.com>

Thanks,
Cristian

> ---
>  drivers/firmware/arm_scmi/mailbox.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c
> index 08ff4d110beb..85b84be85458 100644
> --- a/drivers/firmware/arm_scmi/mailbox.c
> +++ b/drivers/firmware/arm_scmi/mailbox.c
> @@ -94,13 +94,10 @@ static int mailbox_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
>  	cl->knows_txdone = tx;
>  
>  	smbox->chan = mbox_request_channel(cl, tx ? 0 : 1);
> -	if (IS_ERR(smbox->chan)) {
> -		ret = PTR_ERR(smbox->chan);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(cdev, "failed to request SCMI %s mailbox\n",
> -				tx ? "Tx" : "Rx");
> -		return ret;
> -	}
> +	if (IS_ERR(smbox->chan))
> +		return dev_err_probe(cdev, PTR_ERR(smbox->chan),
> +				     "failed to request SCMI %s mailbox\n",
> +				     tx ? "Tx" : "Rx");
>  
>  	cinfo->transport_info = smbox;
>  	smbox->cinfo = cinfo;
> -- 
> 2.17.1
> 



More information about the linux-arm-kernel mailing list