Skip to contentSkip to conversation

Correct error code from -ENOMEM to -EINVAL. Make sure the return value is set in all cases.

PATCH New Hans Petter Selasky 1 participant 1 message May 26, 2011 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Correct error code from -ENOMEM to -EINVAL. Make sure the return value is set in all cases.

Quoted 1 line

From 9b38a5c9878b5e4be2899ae291c4524f5f5fc218 Mon Sep 17 00:00:00 2001

From: Hans Petter Selasky <[email protected]>
Date: Thu, 26 May 2011 09:49:52 +0200
Subject: [PATCH] Correct error code from -ENOMEM to -EINVAL. Make sure the return value is set in all cases.

---
 drivers/media/video/sr030pc30.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/media/video/sr030pc30.c +5 -2
index c901721..8afb0e8 100644
@@ -726,8 +726,10 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on)
 	const struct sr030pc30_platform_data *pdata = info->pdata;
 	int ret;
 
-	if (WARN(pdata == NULL, "No platform data!\n"))
-		return -ENOMEM;
+	if (pdata == NULL) {
+		WARN(1, "No platform data!\n");
+		return -EINVAL;
+	}
 
 	/*
 	 * Put sensor into power sleep mode before switching off
@@ -746,6 +748,7 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on)
 	if (on) {
 		ret = sr030pc30_base_config(sd);
 	} else {
+		ret = 0;
 		info->curr_win = NULL;
 		info->curr_fmt = NULL;
 	}
Signature · 1 line
1.7.1.1