From patchwork Thu Jul 30 21:19:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 30399 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id EBD1BB7BCA for ; Fri, 31 Jul 2009 07:23:07 +1000 (EST) Received: by ozlabs.org (Postfix) id E08C1DDDA0; Fri, 31 Jul 2009 07:23:07 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 72304DDD1C for ; Fri, 31 Jul 2009 07:23:07 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752518AbZG3VWf (ORCPT ); Thu, 30 Jul 2009 17:22:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752459AbZG3VWf (ORCPT ); Thu, 30 Jul 2009 17:22:35 -0400 Received: from mail-fx0-f228.google.com ([209.85.220.228]:58911 "EHLO mail-fx0-f228.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752479AbZG3VWe (ORCPT ); Thu, 30 Jul 2009 17:22:34 -0400 Received: by fxm28 with SMTP id 28so936134fxm.17 for ; Thu, 30 Jul 2009 14:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:mime-version:content-disposition:message-id :content-type:content-transfer-encoding; bh=U+pI5M6J4RPYwTW8vM5o1Ob12EuuZT0jjOP7WLdeNOw=; b=em/ilEUzm5KX+2I1h7pUl0IeEneTmQfaDIL3KTS9ciGpitXRV5+tpXtnFCeUSSwnRf WSEv9FyryD77T9dgbI4D0EVWJVaGGGWQS2KrJ2Emam1UcLJpoTkxmJUJONKlVp5VVetZ w+AoWGqIYKW09rk2q+0V3139f/U8FKmYFyXVk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:content-disposition :message-id:content-type:content-transfer-encoding; b=vaxRx9eTOD4HvB8KFRULT9xdFrsc98k0rPTganU2cuecD5KQKnbd5g5sJibHsDydu6 XOnTqJky0YNE1GlWnEAsTL3mw0sZlHEq7thKxOZc9ojLzBcP19Gj6Se6TaJ7p1HZcAIR NY1UUWGvNC0t+YDo76Xq+k4fnzedCZWblDDtI= Received: by 10.103.178.18 with SMTP id f18mr1011385mup.64.1248988952673; Thu, 30 Jul 2009 14:22:32 -0700 (PDT) Received: from localhost.localdomain (chello089077034197.chello.pl [89.77.34.197]) by mx.google.com with ESMTPS id e9sm16502841muf.32.2009.07.30.14.22.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 30 Jul 2009 14:22:32 -0700 (PDT) From: Bartlomiej Zolnierkiewicz To: Don Fry Subject: [PATCH] pcnet32: remove superfluous NULL pointer check in pcnet32_probe1() Date: Thu, 30 Jul 2009 23:19:17 +0200 User-Agent: KMail/1.11.4 (Linux/2.6.31-rc3-next-20090722-04415-ge5aa24a-dirty; KDE/4.2.4; i686; ; ) Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Carpenter , corbet@lwn.net, eteo@redhat.com, Julia Lawall MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200907302319.18150.bzolnier@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Bartlomiej Zolnierkiewicz Subject: [PATCH] pcnet32: remove superfluous NULL pointer check in pcnet32_probe1() Move the debug printk() into the proper place and remove superfluous NULL pointer check in pcnet32_probe1(). This takes care of the following entry from Dan's list: drivers/net/pcnet32.c +1889 pcnet32_probe1(298) warning: variable derefenced before check 'pdev' Reported-by: Dan Carpenter Cc: corbet@lwn.net Cc: eteo@redhat.com Cc: Julia Lawall Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/net/pcnet32.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) -- 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 Index: b/drivers/net/pcnet32.c =================================================================== --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c @@ -1611,8 +1611,11 @@ pcnet32_probe1(unsigned long ioaddr, int if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 && pcnet32_dwio_check(ioaddr)) { a = &pcnet32_dwio; - } else + } else { + if (pcnet32_debug & NETIF_MSG_PROBE) + printk(KERN_ERR PFX "No access methods\n"); goto err_release_region; + } } chip_version = @@ -1853,12 +1856,6 @@ pcnet32_probe1(unsigned long ioaddr, int ((cards_found >= MAX_UNITS) || full_duplex[cards_found])) lp->options |= PCNET32_PORT_FD; - if (!a) { - if (pcnet32_debug & NETIF_MSG_PROBE) - printk(KERN_ERR PFX "No access methods\n"); - ret = -ENODEV; - goto err_free_consistent; - } lp->a = *a; /* prior to register_netdev, dev->name is not yet correct */ @@ -1974,14 +1971,13 @@ pcnet32_probe1(unsigned long ioaddr, int return 0; - err_free_ring: +err_free_ring: pcnet32_free_ring(dev); - err_free_consistent: pci_free_consistent(lp->pci_dev, sizeof(*lp->init_block), lp->init_block, lp->init_dma_addr); - err_free_netdev: +err_free_netdev: free_netdev(dev); - err_release_region: +err_release_region: release_region(ioaddr, PCNET32_TOTAL_SIZE); return ret; }