From patchwork Mon Mar 21 08:44:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lawrence Yiu X-Patchwork-Id: 8630371 Return-Path: X-Original-To: patchwork-platform-driver-x86@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 385A7C0553 for ; Mon, 21 Mar 2016 08:44:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CD002026D for ; Mon, 21 Mar 2016 08:44:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60796201F4 for ; Mon, 21 Mar 2016 08:44:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751981AbcCUIo0 (ORCPT ); Mon, 21 Mar 2016 04:44:26 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:35321 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751067AbcCUIo0 (ORCPT ); Mon, 21 Mar 2016 04:44:26 -0400 Received: by mail-pf0-f179.google.com with SMTP id n5so257013304pfn.2 for ; Mon, 21 Mar 2016 01:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=U79g+SF4pwBw/jQuQKDj8Hejzrg//6d8O/N00XQ/h44=; b=KGyk3UXClU/3hR4jvISPN/357daawtB6px+0GE4lzP/bQ8oQbaj3+mYVa++IgtOd74 Pmg1/kIw+My3mMm95x/KyKdfBXaQ8Zlz1B0NqJNgYulLqo4ao+S6VCjFrLoJl/y3x5Wz s9S/0N92VWPQpWL7btz4LeKkytIvhk4AXWBx1uvMMu23jamXLVdrgwy5k+j/LU1DezxF JhMqUBV2S5KUtOuzEik/WuCmuX76v9eCYUcsGZq+ypMY6cPlwJ032n2O94aULqqPYlXp uM2595VlYNhKVpQ26y7uBYCfjpv7dQDm+r7bbY2XMgAZXoxPauIUHEoNetQ2UELlmlen luZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=U79g+SF4pwBw/jQuQKDj8Hejzrg//6d8O/N00XQ/h44=; b=ZMq5xJP0ugmNp12xdMd+WlllflWZjIOtgj2UdrDbX86NtPlGq4c07mIECYxFe3Fk/K etRbIgR7zHG8Vt6+BviTTMr2ot4ruFJibxmmsS5JRb+X+dEXSF1QEUOCjJguAEAr+HX3 XFCfAECnBG1dXtvLibqkoWvMzpptWPavsX8Lt9OBxo2yLZwhLL+vN9Hz/IhWiCiSK+TF Toq7cnPyaSNjhU1BE08h87V+3NT5cWb37FEd/G8G4XAb5DsyZ6eu+DLu7LvCroBww4HP mqTDArG8qA9/G+P8JEy2F6MQXXeZLUcOPqw7dHsL0/8hKl8pfofadhMWY+kLzzOId6uU Gbag== X-Gm-Message-State: AD7BkJLW04R4gr2QE0MVBGKNUJyb5crYgIIFIJyKaSDuMz/BX2urBLElY4/9wWnWsQ/VBg== X-Received: by 10.98.71.86 with SMTP id u83mr11297161pfa.156.1458549865349; Mon, 21 Mar 2016 01:44:25 -0700 (PDT) Received: from [192.168.1.83] (104-59-121-21.lightspeed.sntcca.sbcglobal.net. [104.59.121.21]) by smtp.gmail.com with ESMTPSA id qy7sm38676577pab.34.2016.03.21.01.44.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 21 Mar 2016 01:44:24 -0700 (PDT) To: platform-driver-x86@vger.kernel.org Cc: malattia@linux.it From: Lawrence Yiu Subject: [PATCH] sony-laptop: Avoid oops on module unload for older laptops Message-ID: <56EFB466.60008@gmail.com> Date: Mon, 21 Mar 2016 01:44:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Older VAIO laptops without the SN00 ACPI method will have the "handles" variable unset. Return early from sony_nc_function_cleanup when "handles" is null. Signed-off-by: Lawrence Yiu Acked-by: Mattia Dongili --- drivers/platform/x86/sony-laptop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index e9caa34..1dba359 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -1446,6 +1446,9 @@ static void sony_nc_function_cleanup(struct platform_device *pd) { unsigned int i, result, bitmask, handle; + if (!handles) + return; + /* get enabled events and disable them */ sony_nc_int_call(sony_nc_acpi_handle, "SN01", NULL, &bitmask); sony_nc_int_call(sony_nc_acpi_handle, "SN03", &bitmask, &result);