All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] caif: checking the wrong variable
@ 2011-01-15 13:06 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2011-01-15 13:06 UTC (permalink / raw)
  To: Sjur Braendeland; +Cc: David S. Miller, netdev, kernel-janitors

In the original code we check if (servl == NULL) twice.  The first time
should print the message that cfmuxl_remove_uplayer() failed and set
"ret" correctly, but instead it just returns success.  The second check
should be checking the value of "ret" instead of "servl".

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c
index 21ede14..c665de7 100644
--- a/net/caif/cfcnfg.c
+++ b/net/caif/cfcnfg.c
@@ -191,6 +191,7 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
 	struct cflayer *servl = NULL;
 	struct cfcnfg_phyinfo *phyinfo = NULL;
 	u8 phyid = 0;
+
 	caif_assert(adap_layer != NULL);
 	channel_id = adap_layer->id;
 	if (adap_layer->dn == NULL || channel_id == 0) {
@@ -199,16 +200,16 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
 		goto end;
 	}
 	servl = cfmuxl_remove_uplayer(cnfg->mux, channel_id);
-	if (servl == NULL)
-		goto end;
-	layer_set_up(servl, NULL);
-	ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer);
 	if (servl == NULL) {
 		pr_err("PROTOCOL ERROR - Error removing service_layer Channel_Id(%d)",
 		       channel_id);
 		ret = -EINVAL;
 		goto end;
 	}
+	layer_set_up(servl, NULL);
+	ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer);
+	if (ret)
+		goto end;
 	caif_assert(channel_id == servl->id);
 	if (adap_layer->dn != NULL) {
 		phyid = cfsrvl_getphyid(adap_layer->dn);

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

* [patch] caif: checking the wrong variable
@ 2011-01-15 13:06 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2011-01-15 13:06 UTC (permalink / raw)
  To: Sjur Braendeland; +Cc: David S. Miller, netdev, kernel-janitors

In the original code we check if (servl = NULL) twice.  The first time
should print the message that cfmuxl_remove_uplayer() failed and set
"ret" correctly, but instead it just returns success.  The second check
should be checking the value of "ret" instead of "servl".

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c
index 21ede14..c665de7 100644
--- a/net/caif/cfcnfg.c
+++ b/net/caif/cfcnfg.c
@@ -191,6 +191,7 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
 	struct cflayer *servl = NULL;
 	struct cfcnfg_phyinfo *phyinfo = NULL;
 	u8 phyid = 0;
+
 	caif_assert(adap_layer != NULL);
 	channel_id = adap_layer->id;
 	if (adap_layer->dn = NULL || channel_id = 0) {
@@ -199,16 +200,16 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
 		goto end;
 	}
 	servl = cfmuxl_remove_uplayer(cnfg->mux, channel_id);
-	if (servl = NULL)
-		goto end;
-	layer_set_up(servl, NULL);
-	ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer);
 	if (servl = NULL) {
 		pr_err("PROTOCOL ERROR - Error removing service_layer Channel_Id(%d)",
 		       channel_id);
 		ret = -EINVAL;
 		goto end;
 	}
+	layer_set_up(servl, NULL);
+	ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer);
+	if (ret)
+		goto end;
 	caif_assert(channel_id = servl->id);
 	if (adap_layer->dn != NULL) {
 		phyid = cfsrvl_getphyid(adap_layer->dn);

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

* Re: [patch] caif: checking the wrong variable
  2011-01-15 13:06 ` Dan Carpenter
@ 2011-01-15 14:03   ` Sjur Brændeland
  -1 siblings, 0 replies; 6+ messages in thread
From: Sjur Brændeland @ 2011-01-15 14:03 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: David S. Miller, netdev, kernel-janitors

> In the original code we check if (servl == NULL) twice.  The first time
> should print the message that cfmuxl_remove_uplayer() failed and set
> "ret" correctly, but instead it just returns success.  The second check
> should be checking the value of "ret" instead of "servl".
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Thank you for spotting and correcting this.
Looks good to me (reviewed only)

Acked-by: Sjur Braendeland <sjur.brandeland@stericsson.com>

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

* Re: [patch] caif: checking the wrong variable
@ 2011-01-15 14:03   ` Sjur Brændeland
  0 siblings, 0 replies; 6+ messages in thread
From: Sjur Brændeland @ 2011-01-15 14:03 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: David S. Miller, netdev, kernel-janitors

> In the original code we check if (servl = NULL) twice.  The first time
> should print the message that cfmuxl_remove_uplayer() failed and set
> "ret" correctly, but instead it just returns success.  The second check
> should be checking the value of "ret" instead of "servl".
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Thank you for spotting and correcting this.
Looks good to me (reviewed only)

Acked-by: Sjur Braendeland <sjur.brandeland@stericsson.com>

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

* Re: [patch] caif: checking the wrong variable
  2011-01-15 14:03   ` Sjur Brændeland
@ 2011-01-16  5:05     ` David Miller
  -1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-01-16  5:05 UTC (permalink / raw)
  To: sjurbren; +Cc: error27, netdev, kernel-janitors

From: Sjur Brændeland <sjurbren@gmail.com>
Date: Sat, 15 Jan 2011 15:03:31 +0100

>> In the original code we check if (servl == NULL) twice.  The first time
>> should print the message that cfmuxl_remove_uplayer() failed and set
>> "ret" correctly, but instead it just returns success.  The second check
>> should be checking the value of "ret" instead of "servl".
>>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> Thank you for spotting and correcting this.
> Looks good to me (reviewed only)
> 
> Acked-by: Sjur Braendeland <sjur.brandeland@stericsson.com>

Applied, thanks.

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

* Re: [patch] caif: checking the wrong variable
@ 2011-01-16  5:05     ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2011-01-16  5:05 UTC (permalink / raw)
  To: sjurbren; +Cc: error27, netdev, kernel-janitors

From: Sjur Brændeland <sjurbren@gmail.com>
Date: Sat, 15 Jan 2011 15:03:31 +0100

>> In the original code we check if (servl = NULL) twice.  The first time
>> should print the message that cfmuxl_remove_uplayer() failed and set
>> "ret" correctly, but instead it just returns success.  The second check
>> should be checking the value of "ret" instead of "servl".
>>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> Thank you for spotting and correcting this.
> Looks good to me (reviewed only)
> 
> Acked-by: Sjur Braendeland <sjur.brandeland@stericsson.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-01-16  5:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-15 13:06 [patch] caif: checking the wrong variable Dan Carpenter
2011-01-15 13:06 ` Dan Carpenter
2011-01-15 14:03 ` Sjur Brændeland
2011-01-15 14:03   ` Sjur Brændeland
2011-01-16  5:05   ` David Miller
2011-01-16  5:05     ` David Miller

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.