[PATCH] firmware: arm_scmi: return a literal instead of a variable

Cristian Marussi cristian.marussi at arm.com
Thu Feb 23 04:28:46 PST 2023


On Wed, Feb 22, 2023 at 06:17:06PM +0300, Dan Carpenter wrote:
> In this context "return scmi_dev;" and "return NULL;" are equivalent
> but it is more readable to return a literal.
> 
> Signed-off-by: Dan Carpenter <error27 at gmail.com>
> ---
>  drivers/firmware/arm_scmi/bus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
> index 73140b854b31..ac306ca48b07 100644
> --- a/drivers/firmware/arm_scmi/bus.c
> +++ b/drivers/firmware/arm_scmi/bus.c
> @@ -436,7 +436,7 @@ struct scmi_device *scmi_device_create(struct device_node *np,
>  	/* Nothing to do. */
>  	if (!phead) {
>  		mutex_unlock(&scmi_requested_devices_mtx);
> -		return scmi_dev;
> +		return NULL;
>  	}
>  
>  	/* Walk the list of requested devices for protocol and create them */

LGTM.

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

Thanks,
Cristian



More information about the linux-arm-kernel mailing list