* [PATCH] MFD: ab8500-core improved error handling in get_chip_id
@ 2010-12-02 14:08 Mattias Wallin
2010-12-09 12:16 ` Samuel Ortiz
0 siblings, 1 reply; 2+ messages in thread
From: Mattias Wallin @ 2010-12-02 14:08 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel, Linus Walleij, Mattias Wallin
This patch improves the error handling in ab8500_get_chip_id.
Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
---
drivers/mfd/ab8500-core.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index d9640a6..e91b5b7 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -103,8 +103,12 @@ static const int ab8500_irq_regoffset[AB8500_NUM_IRQ_REGS] = {
static int ab8500_get_chip_id(struct device *dev)
{
- struct ab8500 *ab8500 = dev_get_drvdata(dev->parent);
- return (int)ab8500->chip_id;
+ struct ab8500 *ab8500;
+
+ if (!dev)
+ return -EINVAL;
+ ab8500 = dev_get_drvdata(dev->parent);
+ return ab8500 ? (int)ab8500->chip_id : -EINVAL;
}
static int set_register_interruptible(struct ab8500 *ab8500, u8 bank,
--
1.7.2.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] MFD: ab8500-core improved error handling in get_chip_id
2010-12-02 14:08 [PATCH] MFD: ab8500-core improved error handling in get_chip_id Mattias Wallin
@ 2010-12-09 12:16 ` Samuel Ortiz
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2010-12-09 12:16 UTC (permalink / raw)
To: Mattias Wallin; +Cc: linux-kernel, Linus Walleij
Hi Mattias,
On Thu, Dec 02, 2010 at 03:08:32PM +0100, Mattias Wallin wrote:
> This patch improves the error handling in ab8500_get_chip_id.
Patch applied.
One general comment: Your title and changelog should be different. The former
should basically be a one liner explaining what you're doing, and the latter
should explain why and how you're doing so.
Cheers,
Samuel.
> Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
> ---
> drivers/mfd/ab8500-core.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
> index d9640a6..e91b5b7 100644
> --- a/drivers/mfd/ab8500-core.c
> +++ b/drivers/mfd/ab8500-core.c
> @@ -103,8 +103,12 @@ static const int ab8500_irq_regoffset[AB8500_NUM_IRQ_REGS] = {
>
> static int ab8500_get_chip_id(struct device *dev)
> {
> - struct ab8500 *ab8500 = dev_get_drvdata(dev->parent);
> - return (int)ab8500->chip_id;
> + struct ab8500 *ab8500;
> +
> + if (!dev)
> + return -EINVAL;
> + ab8500 = dev_get_drvdata(dev->parent);
> + return ab8500 ? (int)ab8500->chip_id : -EINVAL;
> }
>
> static int set_register_interruptible(struct ab8500 *ab8500, u8 bank,
> --
> 1.7.2.2
>
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-09 12:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-02 14:08 [PATCH] MFD: ab8500-core improved error handling in get_chip_id Mattias Wallin
2010-12-09 12:16 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox