From patchwork Sat Aug 20 15:25:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9291729 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 1AA1A60574 for ; Sat, 20 Aug 2016 15:25:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0026D28C4D for ; Sat, 20 Aug 2016 15:25:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEC3528C50; Sat, 20 Aug 2016 15:25:40 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 74CE128C4D for ; Sat, 20 Aug 2016 15:25:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752835AbcHTPZj (ORCPT ); Sat, 20 Aug 2016 11:25:39 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:35011 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752796AbcHTPZj (ORCPT ); Sat, 20 Aug 2016 11:25:39 -0400 Received: by mail-pa0-f65.google.com with SMTP id cf3so5064548pad.2 for ; Sat, 20 Aug 2016 08:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qCJ/a1NZIIYvxAii8ucTK++6XJF+3iLvsk3ezoACBLA=; b=Vq3SkAUoRizeZlDli9U+59P1W5Qfk373JbwG/3PcIswpWGo7PqTtoszkkIwiRJUFOa xnTmxf5Kyh7Zxb3h2lHOGXyZk6xWKBiUGwHOWQgX59cARzvtQH7DPBhJedUscVdJC2GR 1aruNtyk41BlSAoSJQYpDcfGrEwW2fbMS6Hbgnu6CLKxHtXKJeJYSCoTrx2HCTnIY341 +9amnraz15qWL7JxG25RE6ydN/0tKm8AaTy2WWTYOUnjYhEVXhC3rx3GyrhO5zWSyBhh nhXCS3P5m6zKukiHfcIkMn57q5r2Nv4aolaPCo5yNJxMc+SwF7UzD4EHyJOkVcS4g1Ok jkmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qCJ/a1NZIIYvxAii8ucTK++6XJF+3iLvsk3ezoACBLA=; b=acNiMicltnkUI2WuavLWVfOuLlvFHvW4xc3gQk05nLWIK8XZx9zx1TG4pDUfECdhiu nN3a7VHKWfBgQ/ZSR9vO1ysAQbrByC/1Cct8snLcMT0tNzwk250229q8ObEPoHjAWCJf KHLEcQyhLGfs92VpapNZp/totiDubpbRJF/1NUNOVfnyOuR0+nYDe300QLnROWb9va4/ cadJ1fmqcvbJe8LevFrArvWpd0NPD0xfe4oPhcHQpfbYOouMLE3tEwnSSxXNzKLTX7Nq mPFOvA1OyLNwF6TWe+HsQwbiG84AcyGuMv/8yUZVbJlnkmaQ3+XpK0JJDiiemqGzVmzL Zwlw== X-Gm-Message-State: AEkoouseNnBMQD8dn2kZ5W+vUq0yQWL8zba0BYV1jxd95L4tq9ZsRtsgXPFsB4pLEsLT8g== X-Received: by 10.66.87.6 with SMTP id t6mr24392777paz.141.1471706738353; Sat, 20 Aug 2016 08:25:38 -0700 (PDT) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id u7sm19802939paz.45.2016.08.20.08.25.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Aug 2016 08:25:37 -0700 (PDT) From: Wei Yongjun To: Mark Brown , Chao Fu Cc: Wei Yongjun , linux-spi@vger.kernel.org Subject: [PATCH -next] spi: spi-fsl-dspi: Drop extra spi_master_put in device remove function Date: Sat, 20 Aug 2016 15:25:32 +0000 Message-Id: <1471706732-25944-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The call sequence spi_alloc_master/spi_register_master/spi_unregister_master is complete; it reduces the device reference count to zero, which and results in device memory being freed. The subsequent call to spi_master_put is unnecessary and results in an access to free memory. Drop it. Fixes: 9298bc727385 ("spi: spi-fsl-dspi: Remove spi-bitbang") Signed-off-by: Wei Yongjun --- drivers/spi/spi-fsl-dspi.c | 1 - 1 file changed, 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index d57baf6..0c87186 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -758,7 +758,6 @@ static int dspi_remove(struct platform_device *pdev) /* Disconnect from the SPI framework */ clk_disable_unprepare(dspi->clk); spi_unregister_master(dspi->master); - spi_master_put(dspi->master); return 0; }