All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: most: return error value
@ 2015-11-27  7:37 Sudip Mukherjee
  2015-11-27  7:37 ` [PATCH 2/2] staging: most: avoid assignment in if Sudip Mukherjee
  2016-02-07 22:16 ` [PATCH 1/2] staging: most: return error value Greg Kroah-Hartman
  0 siblings, 2 replies; 5+ messages in thread
From: Sudip Mukherjee @ 2015-11-27  7:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, devel, Sudip Mukherjee

On error we were returning retval, but retval is not having the error
value. We will get the error value using PTR_ERR.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---

This series doesnot depend on my earlier pending series.

 drivers/staging/most/aim-cdev/cdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index dc3fb25..3f7c8bb 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -468,8 +468,8 @@ static int aim_probe(struct most_interface *iface, int channel_id,
 				     NULL,
 				     "%s", name);
 
-	retval = IS_ERR(channel->dev);
-	if (retval) {
+	if (IS_ERR(channel->dev)) {
+		retval = PTR_ERR(channel->dev);
 		pr_info("failed to create new device node %s\n", name);
 		goto error_create_device;
 	}
-- 
1.9.1


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

* [PATCH 2/2] staging: most: avoid assignment in if
  2015-11-27  7:37 [PATCH 1/2] staging: most: return error value Sudip Mukherjee
@ 2015-11-27  7:37 ` Sudip Mukherjee
  2015-11-27  8:25   ` Dan Carpenter
  2015-11-27  8:50   ` andrey.shvetsov
  2016-02-07 22:16 ` [PATCH 1/2] staging: most: return error value Greg Kroah-Hartman
  1 sibling, 2 replies; 5+ messages in thread
From: Sudip Mukherjee @ 2015-11-27  7:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, devel, Sudip Mukherjee

checkpatch is giving a warning about an assignment in the if condition.
The assignment was there as the valid mbo pointer was used after we have
woken up from wait_event_interruptible(). Now even though we donot
assign the pointer to mbo but we will still be able to get the valid
pointer for later use.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/staging/most/aim-cdev/cdev.c          | 10 +++++-----
 drivers/staging/most/aim-network/networking.c |  2 +-
 drivers/staging/most/aim-sound/sound.c        |  4 ++--
 drivers/staging/most/hdm-dim2/dim2_hdm.c      |  2 +-
 drivers/staging/most/mostcore/core.c          |  3 ++-
 drivers/staging/most/mostcore/mostcore.h      |  2 +-
 6 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index 3f7c8bb..ff35967 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -168,17 +168,17 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
 	}
 	mutex_unlock(&channel->io_mutex);
 
-	mbo = most_get_mbo(channel->iface, channel->channel_id, &cdev_aim);
+	mbo = most_get_mbo(channel->iface, channel->channel_id,
+			   &cdev_aim, &mbo);
 
 	if (!mbo) {
 		if ((filp->f_flags & O_NONBLOCK))
 			return -EAGAIN;
 		if (wait_event_interruptible(
 			    channel->wq,
-			    (mbo = most_get_mbo(channel->iface,
-						channel->channel_id,
-						&cdev_aim)) ||
-			    (!channel->dev)))
+			    most_get_mbo(channel->iface, channel->channel_id,
+					 &cdev_aim, &mbo)) ||
+			    (!channel->dev))
 			return -ERESTARTSYS;
 	}
 
diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c
index 3c7beb0..84678bb 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -241,7 +241,7 @@ static netdev_tx_t most_nd_start_xmit(struct sk_buff *skb,
 
 	BUG_ON(nd->dev != dev);
 
-	mbo = most_get_mbo(nd->iface, nd->tx.ch_id, &aim);
+	mbo = most_get_mbo(nd->iface, nd->tx.ch_id, &aim, &mbo);
 
 	if (!mbo) {
 		netif_stop_queue(dev);
diff --git a/drivers/staging/most/aim-sound/sound.c b/drivers/staging/most/aim-sound/sound.c
index 9c64580..f5d5d87 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -240,8 +240,8 @@ static int playback_thread(void *data)
 			channel->playback_waitq,
 			kthread_should_stop() ||
 			(channel->is_stream_running &&
-			 (mbo = most_get_mbo(channel->iface, channel->id,
-					     &audio_aim))));
+			 most_get_mbo(channel->iface, channel->id,
+				      &audio_aim, &mbo)));
 		if (!mbo)
 			continue;
 
diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index 327d738..ef0ca59 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -667,7 +667,7 @@ static void request_netinfo(struct most_interface *most_iface, int ch_idx)
 		return;
 	}
 
-	mbo = most_get_mbo(&dev->most_iface, dev->atx_idx, NULL);
+	mbo = most_get_mbo(&dev->most_iface, dev->atx_idx, NULL, &mbo);
 	if (!mbo)
 		return;
 
diff --git a/drivers/staging/most/mostcore/core.c b/drivers/staging/most/mostcore/core.c
index ed1ed25..535c79b 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -1412,7 +1412,7 @@ EXPORT_SYMBOL_GPL(channel_has_mbo);
  * Returns a pointer to MBO on success or NULL otherwise.
  */
 struct mbo *most_get_mbo(struct most_interface *iface, int id,
-			 struct most_aim *aim)
+			 struct most_aim *aim, struct mbo **mbo_p)
 {
 	struct mbo *mbo;
 	struct most_c_obj *c;
@@ -1446,6 +1446,7 @@ struct mbo *most_get_mbo(struct most_interface *iface, int id,
 
 	mbo->num_buffers_ptr = num_buffers_ptr;
 	mbo->buffer_length = c->cfg.buffer_size;
+	*mbo_p = mbo;
 	return mbo;
 }
 EXPORT_SYMBOL_GPL(most_get_mbo);
diff --git a/drivers/staging/most/mostcore/mostcore.h b/drivers/staging/most/mostcore/mostcore.h
index bda3850..a8957f5 100644
--- a/drivers/staging/most/mostcore/mostcore.h
+++ b/drivers/staging/most/mostcore/mostcore.h
@@ -308,7 +308,7 @@ void most_resume_enqueue(struct most_interface *iface, int channel_idx);
 int most_register_aim(struct most_aim *aim);
 int most_deregister_aim(struct most_aim *aim);
 struct mbo *most_get_mbo(struct most_interface *iface, int channel_idx,
-			 struct most_aim *);
+			 struct most_aim *, struct mbo **);
 void most_put_mbo(struct mbo *mbo);
 int channel_has_mbo(struct most_interface *iface, int channel_idx);
 int most_start_channel(struct most_interface *iface, int channel_idx,
-- 
1.9.1


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

* Re: [PATCH 2/2] staging: most: avoid assignment in if
  2015-11-27  7:37 ` [PATCH 2/2] staging: most: avoid assignment in if Sudip Mukherjee
@ 2015-11-27  8:25   ` Dan Carpenter
  2015-11-27  8:50   ` andrey.shvetsov
  1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2015-11-27  8:25 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Greg Kroah-Hartman, devel, linux-kernel

Just ignore the checkpatch warning.

regards,
dan carpenter


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

* RE: [PATCH 2/2] staging: most: avoid assignment in if
  2015-11-27  7:37 ` [PATCH 2/2] staging: most: avoid assignment in if Sudip Mukherjee
  2015-11-27  8:25   ` Dan Carpenter
@ 2015-11-27  8:50   ` andrey.shvetsov
  1 sibling, 0 replies; 5+ messages in thread
From: andrey.shvetsov @ 2015-11-27  8:50 UTC (permalink / raw)
  To: sudipm.mukherjee; +Cc: gregkh, linux-kernel

Sudip,

please take a look on "[PATCH 23/28] staging: most: fix race conditions".
This already gets read of " warning about an assignment in the if condition".

Regards,
Andrey


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

* Re: [PATCH 1/2] staging: most: return error value
  2015-11-27  7:37 [PATCH 1/2] staging: most: return error value Sudip Mukherjee
  2015-11-27  7:37 ` [PATCH 2/2] staging: most: avoid assignment in if Sudip Mukherjee
@ 2016-02-07 22:16 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-07 22:16 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: devel, linux-kernel

On Fri, Nov 27, 2015 at 01:07:49PM +0530, Sudip Mukherjee wrote:
> On error we were returning retval, but retval is not having the error
> value. We will get the error value using PTR_ERR.
> 
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> 
> This series doesnot depend on my earlier pending series.
> 
>  drivers/staging/most/aim-cdev/cdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Doesn't apply anymore :(

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

end of thread, other threads:[~2016-02-07 22:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-27  7:37 [PATCH 1/2] staging: most: return error value Sudip Mukherjee
2015-11-27  7:37 ` [PATCH 2/2] staging: most: avoid assignment in if Sudip Mukherjee
2015-11-27  8:25   ` Dan Carpenter
2015-11-27  8:50   ` andrey.shvetsov
2016-02-07 22:16 ` [PATCH 1/2] staging: most: return error value Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.