Re: [PATCH v1 3/8] ASoC: loongson: Simplify with dev_err_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, Sep 09, 2024 at 03:19:07PM +0800, Binbin Zhou wrote:

>  	ret = device_property_read_string(dev, "model", &card->name);
> -	if (ret) {
> -		dev_err(dev, "Error parsing card name: %d\n", ret);
> -		return ret;
> -	}
> +	if (ret)
> +		dev_err_probe(dev, ret, "Error parsing card name\n");
> +

This means that we change from failing if there is an error to only
logging about it (and then only during probe).  Perhaps that makes sense
but the changelog should explain what's going on.  Most if not all of
the updates do this, some of them seem like clear bugs.

> -	if (has_acpi_companion(dev))
> -		ret = loongson_card_parse_acpi(ls_priv);
> -	else
> -		ret = loongson_card_parse_of(ls_priv);
> -	if (ret < 0)
> -		return ret;
> +	ret = has_acpi_companion(dev) ? loongson_card_parse_acpi(ls_priv)
> +				      : loongson_card_parse_of(ls_priv);
> +	if (ret)
> +		dev_err_probe(dev, ret, "Error parsing acpi/of properties\n");

Please just write normal conditional statements, they're far clearer -
there's applications for the ternery operator when embedded in other
things but normally it just makes things harder to read.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux