From patchwork Tue Mar 7 20:47:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9609861 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A0F9C6016C for ; Tue, 7 Mar 2017 21:14:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7391828544 for ; Tue, 7 Mar 2017 21:14:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6850428547; Tue, 7 Mar 2017 21:14:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA99C28544 for ; Tue, 7 Mar 2017 21:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756180AbdCGVOf (ORCPT ); Tue, 7 Mar 2017 16:14:35 -0500 Received: from mail-pg0-f50.google.com ([74.125.83.50]:33201 "EHLO mail-pg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbdCGVOe (ORCPT ); Tue, 7 Mar 2017 16:14:34 -0500 Received: by mail-pg0-f50.google.com with SMTP id 25so4825440pgy.0 for ; Tue, 07 Mar 2017 13:14:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=4FfyvOuQItxjHRytFZr8TG1HixX5uzSnJa+jKq+bVpQ=; b=UlYrdUE26a/khEtK2FPy057FIwnUcNw/JaGJH+2ViPjzoM+lhSoDyPt0H5hvdTMKzU LbRF2GJQw3CXt8rHPI7KM6kTUWSWlTIy2MdjvkXEo03JW82wd56D4vlDYkkfSVFDQhYe N7hfH12qxJKsa+oXvpAcRelnHj7LE32RfOPjo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=4FfyvOuQItxjHRytFZr8TG1HixX5uzSnJa+jKq+bVpQ=; b=psJVgAlJsHRSA/9WYDfKg6hTyPROQVMLbH3cFA+vsTfaHInuYS6vzw05d/y08XtoFD d9zN+9UEt31u3nLNgnATDCFBmQnOepVqOax2Qwyp6g0XaGHB6id47gKBZ64c1cASw1WK nffEnOjMshCW9HqcOg7sZtuC0g6gMCmmS8bk4gnkiGbyDVTmh/6UfuwkH4ruu5edOUpa sCCj9vUarMvfW1tdTrWni6fRbtmn0T28dSGwHR5wNj2jJs+nz44fZxqEPtSzbntthvHh PpBXx9vO2SVF72PacrA/TXByzj/fpDiR9ivSLZnHfcPHRVNjgMENCwaCwyFWYpA9LjJC cb2g== X-Gm-Message-State: AMke39l4G1Cq92gHFCj2yufq8l0y1h9OIjaPrWstnZZGTtWhzV8KC8eVfbU+1mp97wrU8sIM X-Received: by 10.99.176.6 with SMTP id h6mr2648715pgf.184.1488919709291; Tue, 07 Mar 2017 12:48:29 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id x10sm1503936pff.72.2017.03.07.12.48.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Mar 2017 12:48:28 -0800 (PST) From: Brian Norris To: Amitkumar Karwar , Nishant Sarmukadam Cc: , Kalle Valo , linux-wireless@vger.kernel.org, Brian Norris Subject: [PATCH] mwifiex: pcie: clean up error prints in mwifiex_pcie_reset_notify() Date: Tue, 7 Mar 2017 12:47:46 -0800 Message-Id: <20170307204746.6294-1-briannorris@chromium.org> X-Mailer: git-send-email 2.12.0.rc1.440.g5b76565f74-goog Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We shouldn't be printing a kernel pointer as a decimal integer. But we really shouldn't be printing this case at all; we should never get here with NULL drvdata. We've eliminated this unnecessary conditional in several other places, so kill it here too. Similarly, there's no need to check for '!pdev'; we are guaranteed to have a real device here. And finally, use dev_err() instead of pr_err(). This yields (for failed PCIe resets): [ 68.286586] mwifiex_pcie 0000:01:00.0: mwifiex_pcie_reset_notify: adapter structure is not valid instead of: [ 82.932658] mwifiex_pcie: mwifiex_pcie_reset_notify: Card or adapter structure is not valid (-270880688088) Signed-off-by: Brian Norris --- drivers/net/wireless/marvell/mwifiex/pcie.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index a0d918094889..5438483fcefe 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -350,22 +350,15 @@ MODULE_DEVICE_TABLE(pci, mwifiex_ids); static void mwifiex_pcie_reset_notify(struct pci_dev *pdev, bool prepare) { - struct mwifiex_adapter *adapter; - struct pcie_service_card *card; - - if (!pdev) { - pr_err("%s: PCIe device is not specified\n", __func__); - return; - } + struct pcie_service_card *card = pci_get_drvdata(pdev); + struct mwifiex_adapter *adapter = card->adapter; - card = (struct pcie_service_card *)pci_get_drvdata(pdev); - if (!card || !card->adapter) { - pr_err("%s: Card or adapter structure is not valid (%ld)\n", - __func__, (long)card); + if (!adapter) { + dev_err(&pdev->dev, "%s: adapter structure is not valid\n", + __func__); return; } - adapter = card->adapter; mwifiex_dbg(adapter, INFO, "%s: vendor=0x%4.04x device=0x%4.04x rev=%d %s\n", __func__, pdev->vendor, pdev->device,