From: Rickard Strandqvist Date: Sat, 7 Jun 2014 10:22:08 +0000 (+0200) Subject: net: ethernet: toshiba: ps3_gelic_net.c: Cleaning up a check on a memory allocation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=655aa393063b0cca03d1c4d1d2971b9b9770525b;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git net: ethernet: toshiba: ps3_gelic_net.c: Cleaning up a check on a memory allocation A check on a memory allocation is checked incorrectly. This was partly found using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist Acked-by: Geoff Levand Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index d899d0072ae0..bb7992804664 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c @@ -1561,7 +1561,7 @@ static struct gelic_card *gelic_alloc_card_net(struct net_device **netdev) * alloc netdev */ *netdev = alloc_etherdev(sizeof(struct gelic_port)); - if (!netdev) { + if (!*netdev) { kfree(card->unalign); return NULL; }