linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen: check return value of xenbus_printf
@ 2015-10-15 16:25 Insu Yun
  2015-10-15 16:40 ` David Vrabel
  0 siblings, 1 reply; 9+ messages in thread
From: Insu Yun @ 2015-10-15 16:25 UTC (permalink / raw)
  To: dmitry.torokhov, david.vrabel, wei.liu2, julien.grall,
	stefano.stabellini, huaixin.chx, linux-input, linux-kernel
  Cc: taesoo, yeongjin.jang, insu, Insu Yun

Internally, xenbus_printf uses memory allocation, so it can be failed in
memory pressure.Therefore, xenbus_printf's return should be checked 
and properly handled.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/input/misc/xen-kbdfront.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 23d0549..a3b0940 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -129,8 +129,11 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
 		abs = 0;
-	if (abs)
-		xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
+	if (abs) {
+		ret = xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
+		if (ret)
+			pr_warning("xenkbd: can't request abs-pointer");
+  }
 
 	/* keyboard */
 	kbd = input_allocate_device();
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] xen: check return value of xenbus_printf
@ 2015-10-15 18:40 Insu Yun
  2015-10-16  0:01 ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Insu Yun @ 2015-10-15 18:40 UTC (permalink / raw)
  To: dmitry.torokhov, david.vrabel, wei.liu2, julien.grall,
	stefano.stabellini, huaixin.chx, linux-input, linux-kernel
  Cc: taesoo, yeongjin.jang, insu, Insu Yun

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/input/misc/xen-kbdfront.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 23d0549..9d465d7 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -129,8 +129,14 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
 		abs = 0;
-	if (abs)
-		xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
+	if (abs) {
+		ret = xenbus_printf(XBT_NIL, dev->nodename,
+					"request-abs-pointer", "1");
+		if (ret) {
+			pr_warning("xenkbd: can't request abs-pointer");
+			abs = 0;
+		}
+	}
 
 	/* keyboard */
 	kbd = input_allocate_device();
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] xen: check return value of xenbus_printf
@ 2015-10-19 14:10 Insu Yun
  2015-10-19 14:30 ` Julien Grall
  0 siblings, 1 reply; 9+ messages in thread
From: Insu Yun @ 2015-10-19 14:10 UTC (permalink / raw)
  To: dmitry.torokhov, stefano.stabellini, david.vrabel, wei.liu2,
	julien.grall, linux-input, linux-kernel
  Cc: taesoo, yeongjin.jang, insu, changwoo, Insu Yun

Internally, xenbus_printf uses memory allocation, so it can be failed in
memory pressure.Therefore, xenbus_printf's return should be checked
and properly handled.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/input/misc/xen-kbdfront.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 23d0549..9d465d7 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -129,8 +129,14 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
 		abs = 0;
-	if (abs)
-		xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
+	if (abs) {
+		ret = xenbus_printf(XBT_NIL, dev->nodename,
+					"request-abs-pointer", "1");
+		if (ret) {
+			pr_warning("xenkbd: can't request abs-pointer");
+			abs = 0;
+		}
+	}
 
 	/* keyboard */
 	kbd = input_allocate_device();
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] xen: check return value of xenbus_printf
@ 2015-10-19 16:02 Insu Yun
  2015-10-19 16:46 ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Insu Yun @ 2015-10-19 16:02 UTC (permalink / raw)
  To: dmitry.torokhov, wei.liu2, david.vrabel, stefano.stabellini,
	julien.grall, linux-input, linux-kernel
  Cc: taesoo, yeongjin.jang, insu, changwoo, Insu Yun

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/input/misc/xen-kbdfront.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 23d0549..0a9ad2cf 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -129,8 +129,14 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
 		abs = 0;
-	if (abs)
-		xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
+	if (abs) {
+		ret = xenbus_printf(XBT_NIL, dev->nodename,
+				    "request-abs-pointer", "1");
+		if (ret) {
+			pr_warning("xenkbd: can't request abs-pointer");
+			abs = 0;
+		}
+	}
 
 	/* keyboard */
 	kbd = input_allocate_device();
-- 
1.9.1


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

end of thread, other threads:[~2015-10-19 16:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 16:25 [PATCH] xen: check return value of xenbus_printf Insu Yun
2015-10-15 16:40 ` David Vrabel
     [not found]   ` <CAGoFzNeiu0sNXUh_JtGp8_HWA+k5xq9s-D4qFqU43Vgm=bYiiA@mail.gmail.com>
2015-10-15 18:20     ` Julien Grall
  -- strict thread matches above, loose matches on Subject: below --
2015-10-15 18:40 Insu Yun
2015-10-16  0:01 ` Dmitry Torokhov
2015-10-19 14:10 Insu Yun
2015-10-19 14:30 ` Julien Grall
2015-10-19 16:02 Insu Yun
2015-10-19 16:46 ` Dmitry Torokhov

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).