Commit Graph

5 Commits

Author SHA1 Message Date
Erick Archer 9ac3ebaef3 Documentation: power: Use kcalloc() instead of kzalloc()
As noted in the "Deprecated Interfaces, Language Features, Attributes,
and Conventions" documentation [1], size calculations (especially
multiplication) should not be performed in memory allocator (or similar)
function arguments due to the risk of them overflowing. This could lead
to values wrapping around and a smaller allocation being made than the
caller was expecting. Using those allocations could lead to linear
overflows of heap memory and other misbehaviors.

So, in the example code use the purpose specific kcalloc() function
instead of the argument size * count in the kzalloc() function.

At the same time, modify the translations accordingly.

Signed-off-by: Erick Archer <erick.archer@gmx.com>
Reviewed-by: Hu Haowen <2023002089@link.tyut.edu.cn>
Reviewed-by: Yanteng Si <siyanteng@loongson.cn>
Reviewed-by: Hu Haowen <2023002089@link.tyut.edu.cn>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2024-01-23 11:40:42 +05:30
Tang Yizhou 489a00ef46 Documentation: power: Update outdated contents in opp.rst
Three problems have been revised:
1. CONFIG_PM_OPP no longer depends on CONFIG_PM.
2. opp_find_freq_{ceil, floor} is renamed as dev_pm_opp_find_freq_{ceil,
   floor}.
3. Make it clear that the 'opp' struct is actually dev_pm_opp.

Signed-off-by: Tang Yizhou <tangyizhou@huawei.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2021-12-27 09:47:52 +05:30
Bjorn Helgaas 1992b66d2f PM: Wrap documentation to fit in 80 columns
Wrap to 80 columns.  No textual change except to correct some "it's" that
should be "its".

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-11-20 12:16:37 +01:00
Yue Hu 27a84f7673 PM / OPP: Correct Documentation about library location
OPP library is now located in drivers/opp/ directory.

Signed-off-by: Yue Hu <huyue2@yulong.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2019-07-26 13:25:52 +05:30
Mauro Carvalho Chehab 151f4e2bdc docs: power: convert docs to ReST and rename to *.rst
Convert the PM documents to ReST, in order to allow them to
build with Sphinx.

The conversion is actually:
  - add blank lines and indentation in order to identify paragraphs;
  - fix tables markups;
  - add some lists markups;
  - mark literal blocks;
  - adjust title markups.

At its new index.rst, let's add a :orphan: while this is not linked to
the main index.rst file, in order to avoid build warnings.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Srivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu>
2019-06-14 16:08:36 -05:00