lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 24 Jan 2020 04:18:36 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Sameer Pujar <spujar@...dia.com>, perex@...ex.cz, tiwai@...e.com,
        robh+dt@...nel.org
Cc:     devicetree@...r.kernel.org, alsa-devel@...a-project.org,
        atalambedu@...dia.com, linux-kernel@...r.kernel.org,
        lgirdwood@...il.com, jonathanh@...dia.com, viswanathl@...dia.com,
        sharadg@...dia.com, broonie@...nel.org, thierry.reding@...il.com,
        linux-tegra@...r.kernel.org, rlokhande@...dia.com,
        mkumard@...dia.com, dramesh@...dia.com
Subject: Re: [alsa-devel] [PATCH 5/9] ASoC: tegra: add Tegra210 based AHUB
 driver

20.01.2020 17:23, Sameer Pujar пишет:
[snip]
> +static int tegra_ahub_get_value_enum(struct snd_kcontrol *kctl,
> +				     struct snd_ctl_elem_value *uctl)
> +{
> +	struct snd_soc_component *cmpnt = snd_soc_dapm_kcontrol_component(kctl);
> +	struct tegra_ahub *ahub = snd_soc_component_get_drvdata(cmpnt);
> +	struct soc_enum *e = (struct soc_enum *)kctl->private_value;
> +	unsigned int reg, i, bit_pos = 0;
> +
> +	/*
> +	 * Find the bit position of current MUX input.
> +	 * If nothing is set, position would be 0 and it corresponds to 'None'.
> +	 */
> +	for (i = 0; i < ahub->soc_data->reg_count; i++) {
> +		unsigned int reg_val;
> +
> +		reg = e->reg + (TEGRA210_XBAR_PART1_RX * i);
> +		snd_soc_component_read(cmpnt, reg, &reg_val);
> +		reg_val &= ahub->soc_data->mask[i];
> +
> +		if (reg_val) {
> +			bit_pos = ffs(reg_val) +
> +				  (8 * cmpnt->val_bytes * i);

Multiplication takes precedence, braces are not needed. Same for all
other occurrences in the code.

[snip]
> +			break;
> +		}
> +	}
> +
> +	/* Find index related to the item in array *_ahub_mux_texts[] */
> +	for (i = 0; i < e->items; i++) {
> +		if (bit_pos == e->values[i]) {
> +			uctl->value.enumerated.item[0] = i;
> +			break;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static int tegra_ahub_put_value_enum(struct snd_kcontrol *kctl,
> +				     struct snd_ctl_elem_value *uctl)
> +{
> +	struct snd_soc_component *cmpnt = snd_soc_dapm_kcontrol_component(kctl);
> +	struct tegra_ahub *ahub = snd_soc_component_get_drvdata(cmpnt);
> +	struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctl);
> +	struct soc_enum *e = (struct soc_enum *)kctl->private_value;
> +	struct snd_soc_dapm_update update[TEGRA_XBAR_UPDATE_MAX_REG] = { };

Shouldn't this be {0} to make array zero'ed?

[snip]
> +static int tegra_ahub_probe(struct platform_device *pdev)
> +{
> +	const struct of_device_id *match;
> +	struct tegra_ahub *ahub;
> +	struct tegra_ahub_soc_data *soc_data;
> +	void __iomem *regs;
> +	struct resource *res;
> +	int ret;
> +
> +	match = of_match_device(tegra_ahub_of_match, &pdev->dev);
> +	if (!match) {
> +		dev_err(&pdev->dev, "error: no device match found\n");
> +		return -ENODEV;
> +	}
> +
> +	soc_data = (struct tegra_ahub_soc_data *)match->data;

soc_data = device_get_match_data(&pdev->dev);

> +	ahub = devm_kcalloc(&pdev->dev, 1, sizeof(*ahub), GFP_KERNEL);
> +	if (!ahub)
> +		return -ENOMEM;
> +
> +	ahub->soc_data = soc_data;
> +
> +	platform_set_drvdata(pdev, ahub);
> +
> +	ahub->clk = devm_clk_get(&pdev->dev, "ahub");
> +	if (IS_ERR(ahub->clk)) {
> +		dev_err(&pdev->dev, "can't retrieve AHUB clock\n");
> +		return PTR_ERR(ahub->clk);
> +	}
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +
> +	regs = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(regs))
> +		return PTR_ERR(regs);

regs = devm_platform_ioremap_resource(pdev, 0);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ