Re: [PATCH v7 14/16] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets

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

 



On Wed, Apr 10, 2024 at 02:46:26PM +0200, Bartosz Golaszewski wrote:

...

> +static int pwrseq_qcom_wcn_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct pwrseq_qcom_wcn_ctx *ctx;
> +	struct pwrseq_config config;
> +	int i, ret;
> +
> +	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
> +	if (!ctx)
> +		return -ENOMEM;
> +
> +	ctx->of_node = dev->of_node;
> +
> +	ctx->pdata = of_device_get_match_data(dev);
> +	if (!ctx->pdata)
> +		return dev_err_probe(dev, -ENODEV,
> +				     "Failed to obtain platform data\n");
> +
> +	ctx->regs = devm_kcalloc(dev, ctx->pdata->num_vregs,
> +				 sizeof(*ctx->regs), GFP_KERNEL);
> +	if (!ctx->regs)
> +		return -ENOMEM;
> +
> +	for (i = 0; i < ctx->pdata->num_vregs; i++)
> +		ctx->regs[i].supply = ctx->pdata->vregs[i];
> +
> +	ret = devm_regulator_bulk_get(dev, ctx->pdata->num_vregs, ctx->regs);
> +	if (ret < 0)
> +		return dev_err_probe(dev, PTR_ERR(ctx->regs),
> +				     "Failed to get all regulators\n");

Hi Bartosz,

It looks like ctx->regs is not an error pointer here,
should this be:

		return dev_err_probe(dev, ret, ...

Flagged by Smatch.

> +
> +	ctx->bt_gpio = devm_gpiod_get_optional(dev, "bt-enable", GPIOD_OUT_LOW);
> +	if (IS_ERR(ctx->bt_gpio))
> +		return dev_err_probe(dev, PTR_ERR(ctx->bt_gpio),
> +				     "Failed to get the Bluetooth enable GPIO\n");
> +
> +	ctx->wlan_gpio = devm_gpiod_get_optional(dev, "wlan-enable",
> +						 GPIOD_OUT_LOW);
> +	if (IS_ERR(ctx->wlan_gpio))
> +		return dev_err_probe(dev, PTR_ERR(ctx->wlan_gpio),
> +				     "Failed to get the WLAN enable GPIO\n");
> +
> +	ctx->clk = devm_clk_get_optional(dev, NULL);
> +	if (IS_ERR(ctx->clk))
> +		return dev_err_probe(dev, PTR_ERR(ctx->clk),
> +				     "Failed to get the reference clock\n");
> +
> +	memset(&config, 0, sizeof(config));
> +
> +	config.parent = dev;
> +	config.owner = THIS_MODULE;
> +	config.drvdata = ctx;
> +	config.match = pwrseq_qcom_wcn_match;
> +	config.targets = pwrseq_qcom_wcn_targets;
> +
> +	ctx->pwrseq = devm_pwrseq_device_register(dev, &config);
> +	if (IS_ERR(ctx->pwrseq))
> +		return dev_err_probe(dev, PTR_ERR(ctx->pwrseq),
> +				     "Failed to register the power sequencer\n");
> +
> +	return 0;
> +}

...




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux