public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Khalid Aziz <khalid.aziz@oracle.com>
To: mchehab@redhat.com, dougthompson@xmission.com
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	khalid@gonehiking.org
Subject: [PATCH] Avoid unnecessary calls to sandybridge mce decoder on incompatible platform
Date: Fri, 29 Mar 2013 16:13:58 -0600	[thread overview]
Message-ID: <1364595238.26110.3.camel@concerto> (raw)

Add MCE decoder to MCE decode chain in probe routine instead
of in init routine so that handler is not called unless the
driver is indeed running on SandyBridge.


Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
---
 drivers/edac/sb_edac.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 57244f9..6f05ffd 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -1724,6 +1724,7 @@ static int sbridge_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 			goto fail1;
 	}
 
+	mce_register_decode_chain(&sbridge_mce_dec);
 	sbridge_printk(KERN_INFO, "Driver loaded.\n");
 
 	mutex_unlock(&sbridge_edac_lock);
@@ -1803,10 +1804,8 @@ static int __init sbridge_init(void)
 
 	pci_rc = pci_register_driver(&sbridge_driver);
 
-	if (pci_rc >= 0) {
-		mce_register_decode_chain(&sbridge_mce_dec);
+	if (pci_rc >= 0)
 		return 0;
-	}
 
 	sbridge_printk(KERN_ERR, "Failed to register device with error %d.\n",
 		      pci_rc);
-- 
1.7.10.4




                 reply	other threads:[~2013-03-29 22:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364595238.26110.3.camel@concerto \
    --to=khalid.aziz@oracle.com \
    --cc=dougthompson@xmission.com \
    --cc=khalid@gonehiking.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox