linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: emsff: properly handle emsff_init failure
@ 2011-07-19  8:14 Axel Lin
  2011-07-20  9:56 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-07-19  8:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ignaz Forster, Jiri Kosina, linux-input

emsff_init() may fail, let's properly handle the failure.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/hid/hid-emsff.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/hid-emsff.c b/drivers/hid/hid-emsff.c
index 81877c6..a5dc13f 100644
--- a/drivers/hid/hid-emsff.c
+++ b/drivers/hid/hid-emsff.c
@@ -126,7 +126,12 @@ static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		goto err;
 	}
 
-	emsff_init(hdev);
+	ret = emsff_init(hdev);
+	if (ret) {
+		dev_err(&hdev->dev, "force feedback init failed\n");
+		hid_hw_stop(hdev);
+		goto err;
+	}
 
 	return 0;
 err:
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] HID: emsff: properly handle emsff_init failure
  2011-07-19  8:14 [PATCH] HID: emsff: properly handle emsff_init failure Axel Lin
@ 2011-07-20  9:56 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2011-07-20  9:56 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Ignaz Forster, linux-input

On Tue, 19 Jul 2011, Axel Lin wrote:

> emsff_init() may fail, let's properly handle the failure.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/hid/hid-emsff.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/hid/hid-emsff.c b/drivers/hid/hid-emsff.c
> index 81877c6..a5dc13f 100644
> --- a/drivers/hid/hid-emsff.c
> +++ b/drivers/hid/hid-emsff.c
> @@ -126,7 +126,12 @@ static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  		goto err;
>  	}
>  
> -	emsff_init(hdev);
> +	ret = emsff_init(hdev);
> +	if (ret) {
> +		dev_err(&hdev->dev, "force feedback init failed\n");
> +		hid_hw_stop(hdev);
> +		goto err;
> +	}
>  
>  	return 0;
>  err:

Good catch, applied, thanks.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-20  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-19  8:14 [PATCH] HID: emsff: properly handle emsff_init failure Axel Lin
2011-07-20  9:56 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).