Patchwork skfp: testing the wrong variable in skfp_driver_init()

login
register
mail settings
Submitter Dan Carpenter
Date Dec. 24, 2010, 5:17 a.m.
Message ID <20101224051734.GO1936@bicker>
Download mbox | patch
Permalink /patch/76608/
State Accepted
Delegated to: David Miller
Headers show

Comments

Dan Carpenter - Dec. 24, 2010, 5:17 a.m.
The intent here was to test if the allocation failed but we tested 
"SharedMemSize" instead of "SharedMemAddr" by mistake.

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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Pirko - Dec. 24, 2010, 8:45 a.m.
Fri, Dec 24, 2010 at 06:17:34AM CET, error27@gmail.com wrote:
>The intent here was to test if the allocation failed but we tested 
>"SharedMemSize" instead of "SharedMemAddr" by mistake.
>
>Signed-off-by: Dan Carpenter <error27@gmail.com>
>
>diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
>index 0a66fed..16c6265 100644
>--- a/drivers/net/skfp/skfddi.c
>+++ b/drivers/net/skfp/skfddi.c
>@@ -412,7 +412,7 @@ static  int skfp_driver_init(struct net_device *dev)
> 		bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
> 							 bp->SharedMemSize,
> 							 &bp->SharedMemDMA);
>-		if (!bp->SharedMemSize) {
>+		if (!bp->SharedMemAddr) {
> 			printk("could not allocate mem for ");
> 			printk("hardware module: %ld byte\n",
> 			       bp->SharedMemSize);

Looks obvious.

Reviewed-by: Jiri Pirko <jpirko@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Dec. 28, 2010, 9:55 p.m.
From: Jiri Pirko <jpirko@redhat.com>
Date: Fri, 24 Dec 2010 09:45:39 +0100

> Fri, Dec 24, 2010 at 06:17:34AM CET, error27@gmail.com wrote:
>>The intent here was to test if the allocation failed but we tested 
>>"SharedMemSize" instead of "SharedMemAddr" by mistake.
>>
>>Signed-off-by: Dan Carpenter <error27@gmail.com>
>>
>>diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
>>index 0a66fed..16c6265 100644
>>--- a/drivers/net/skfp/skfddi.c
>>+++ b/drivers/net/skfp/skfddi.c
>>@@ -412,7 +412,7 @@ static  int skfp_driver_init(struct net_device *dev)
>> 		bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
>> 							 bp->SharedMemSize,
>> 							 &bp->SharedMemDMA);
>>-		if (!bp->SharedMemSize) {
>>+		if (!bp->SharedMemAddr) {
>> 			printk("could not allocate mem for ");
>> 			printk("hardware module: %ld byte\n",
>> 			       bp->SharedMemSize);
> 
> Looks obvious.
> 
> Reviewed-by: Jiri Pirko <jpirko@redhat.com>

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

Patch

diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index 0a66fed..16c6265 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -412,7 +412,7 @@  static  int skfp_driver_init(struct net_device *dev)
 		bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
 							 bp->SharedMemSize,
 							 &bp->SharedMemDMA);
-		if (!bp->SharedMemSize) {
+		if (!bp->SharedMemAddr) {
 			printk("could not allocate mem for ");
 			printk("hardware module: %ld byte\n",
 			       bp->SharedMemSize);