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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1383682529.4387.37.camel@joe-AO722>
Date:	Tue, 05 Nov 2013 12:15:29 -0800
From:	Joe Perches <joe@...ches.com>
To:	Wendy Ng <wendy.ng@...adcom.com>
Cc:	Rob Herring <rob.herring@...xeda.com>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Stephen Warren <swarren@...dotorg.org>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Eduardo Valentin <eduardo.valentin@...com>,
	Kumar Gala <galak@...eaurora.org>, devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
	Christian Daudt <bcm@...thebug.org>,
	Markus Mayer <mmayer@...adcom.com>,
	Tim Kryger <tim.kryger@...aro.org>,
	Matt Porter <matt.porter@...aro.org>
Subject: Re: [PATCH V2 1/3] thermal: bcm281xx: Add Temperature Monitor driver

On Tue, 2013-11-05 at 11:54 -0800, Wendy Ng wrote:
> This adds the support for Temperature Monitor (TMON) driver for
> Broadcom bcm281xx SoCs. This driver plugs into the Thermal Framework.

trivia:

> diff --git a/drivers/thermal/bcm_kona_tmon.c b/drivers/thermal/bcm_kona_tmon.c

Please add
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
before any #include to prefix the pr_<level> dmesg output.

If you _really_ want __func__ with each output, you could use
#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
though I think __func__ isn't particularly useful.

> +#include <linux/clk.h>
> +#include <linux/err.h>
[]
> +static int bcm_get_temp(void *sensor_data, long *temp)
> +{
> +	u32 raw;
> +	long mcelsius;
> +	struct bcm_tmon_data_priv *priv = sensor_data;
> +
> +	if (!priv) {
> +		pr_err("%s: input sensor_data not initialized.\n", __func__);

then this could become
		pr_err("input sensor_data not initialized\n");

Also, there's no real need to terminate messages with sentence
ending ".".  dmesg output generally isn't a sentence.

> +		return -EINVAL;
> +	}
> +
> +	raw = (readl(priv->base + TMON_TEMP_VAL_OFFSET)
> +		& TMON_TEMP_VAL_TEMP_VAL_MASK) >> TMON_TEMP_VAL_TEMP_VAL_SHIFT;
> +
> +	pr_debug("%s: raw temp 0x%x\n", __func__, raw);

also consider:

	pr_debug("raw temp: %#x\n", raw);


> +static int bcm_kona_tmon_probe(struct platform_device *pdev)
> +{
[]
> +	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> +	if (!priv) {
> +		dev_err(&pdev->dev, "Failed to malloc priv.\n");
> +		return -ENOMEM;
> +	}

Generic OOM messages are already emitted by devm_kzalloc.
This could be written as:

	priv = devm_kzalloc(etc...)
	if (!priv)
		return -ENOMEM;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ