[Some people who received this message don't often get email from andriy.shevchenko@xxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]Sorry, I didn't fully understand what you meant, it's my problem. I guess
On Fri, Aug 23, 2024 at 11:51:15AM +0800, Rong Qianfeng wrote:
The devm_clk_get_enabled() helpers:...
- call devm_clk_get()
- call clk_prepare_enable() and register what is needed in order to
call clk_disable_unprepare() when needed, as a managed resource.
This simplifies the code and avoids the calls to clk_disable_unprepare().
While at it, no more special handling needed here, remove the goto
label "err:".
ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency",(side note: this driver should use i2c_timings and respective I2C core
&clk_freq);
APIs instead of this)
if (ret) {While at it,
dev_err(&pdev->dev, "clock-frequency not specified in DT\n");
- goto err;
+ return ret;
return dev_err_probe(...);
}(side note: this should be HZ_PER_KHZ from units.h)
i2c->speed = clk_freq / 1000;
if (i2c->speed == 0) {return dev_err_probe(...);
ret = -EINVAL;
dev_err(&pdev->dev, "clock-frequency minimum is 1000\n");
- goto err;
+ return ret;
}...
ret = platform_get_irq(pdev, 0);I would add a blank line here.
if (ret < 0)
- goto err;
+ return ret;
i2c->irq = ret;
ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0,
dev_name(&pdev->dev), i2c);
if (ret)
- goto err;
+ return ret;
--
With Best Regards,
Andy Shevchenko