From patchwork Mon Jun 26 05:45:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AbdAllah-MEZITI X-Patchwork-Id: 9808647 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 E3DAD60329 for ; Mon, 26 Jun 2017 05:45:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C696828408 for ; Mon, 26 Jun 2017 05:45:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A514128429; Mon, 26 Jun 2017 05:45:48 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 2FE4428408 for ; Mon, 26 Jun 2017 05:45:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751132AbdFZFpr (ORCPT ); Mon, 26 Jun 2017 01:45:47 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33193 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751008AbdFZFpq (ORCPT ); Mon, 26 Jun 2017 01:45:46 -0400 Received: by mail-wr0-f195.google.com with SMTP id x23so28026507wrb.0; Sun, 25 Jun 2017 22:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=iyTM1jm+TsOzXyQF8p9pIsfTjbX1HQRzlae3mB182t4=; b=XzdoT32382GW7ltXX3X9V22ILDF3zswu6AtQAdbICpk9q+7FWWU6J+lbwe63txhyNA UBG2qDKOnJGCKxCrwpt1I8T3kHX9ZGtvUi3HghRNpq9v+gHsgOMNrBQHQ9zzsJM+/PQ7 lBIuw7I2ARNU2ml5JfKBro6RiUXso5jS2+oluAKtQNBS7s6jzDjzu0WzKZrgg9b4jAUq miX0MsAdovTHiMQCYu80rG0mmRVTLs4pfuCO7MMVGLMAIKETkuiwMWSn0xvhDWhS7JYL +Dy07uChPqs3KDS7tjSDLfguVoFkNN/RtKGE49hRwQVD0rD8KA+DcPLToKBkB1P+TQ79 jURQ== 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=iyTM1jm+TsOzXyQF8p9pIsfTjbX1HQRzlae3mB182t4=; b=JVRW48IMDd+NGQSJ7CpwnTnDEsjNtXgIKq4HiABxgi2q6zWs5kN8BhESktuRADm0Dq y2C/aJ0PuoVhJ1KHAKbbc3+doayhDm3J0I9fjJd3NsljPcJP7yQA3rUaj9DDwr+PyTew n3Vwq1PLTmlytvwxkTyiPqEpbiQy959Kb1BTQTCDJwsp5w5qwfccOzHERYZeezN2SI+X XUjEBfl9k1IHRfc+e8IxwEU53qO3KPF55jnNU5DMy3z1fV2lQMmeXeCpgMgASJBWBxUk wGFHPV6GkJc9SQumf96OQ/XGJkhTLb3DVzGN3IvqTM62prpUQn+hYk3nYBNfiLpHQPHf tkHw== X-Gm-Message-State: AKS2vOzLSaDp0po3y2VB7wHfCDZrUTiKIdeN3Zk8rG2Z4KnrkZ7WjIrF nhQBjdKxlWCrEomG X-Received: by 10.223.131.225 with SMTP id 88mr13008204wre.51.1498455945317; Sun, 25 Jun 2017 22:45:45 -0700 (PDT) Received: from localhost.localdomain (bty91-h01-176-179-209-84.dsl.sta.abo.bbox.fr. [176.179.209.84]) by smtp.gmail.com with ESMTPSA id t74sm6796732wmt.19.2017.06.25.22.45.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Jun 2017 22:45:44 -0700 (PDT) From: AbdAllah-MEZITI To: sudipm.mukherjee@gmail.com Cc: AbdAllah MEZITI , Teddy Wang , Greg Kroah-Hartman , linux-fbdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: sm750fb: always take the lock Date: Mon, 26 Jun 2017 07:45:33 +0200 Message-Id: <1498455936-2108-1-git-send-email-abdallah.meziti.pro@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch - will always take the lock - fix the sparse warning: drivers/staging/sm750fb/sm750.c:159:13: warning: context imbalance in 'lynxfb_ops_fillrect' - different lock contexts for basic block drivers/staging/sm750fb/sm750.c:231:9: warning: context imbalance in 'lynxfb_ops_copyarea' - different lock contexts for basic block drivers/staging/sm750fb/sm750.c:235:13: warning: context imbalance in 'lynxfb_ops_imageblit' - different lock contexts for basic block Signed-off-by: AbdAllah MEZITI --- drivers/staging/sm750fb/sm750.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index 386d4ad..4a22190 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -186,16 +186,14 @@ static void lynxfb_ops_fillrect(struct fb_info *info, * If not use spin_lock,system will die if user load driver * and immediately unload driver frequently (dual) */ - if (sm750_dev->fb_count > 1) - spin_lock(&sm750_dev->slock); + spin_lock(&sm750_dev->slock); sm750_dev->accel.de_fillrect(&sm750_dev->accel, base, pitch, Bpp, region->dx, region->dy, region->width, region->height, color, rop); - if (sm750_dev->fb_count > 1) - spin_unlock(&sm750_dev->slock); + spin_unlock(&sm750_dev->slock); } static void lynxfb_ops_copyarea(struct fb_info *info, @@ -220,16 +218,14 @@ static void lynxfb_ops_copyarea(struct fb_info *info, * If not use spin_lock, system will die if user load driver * and immediately unload driver frequently (dual) */ - if (sm750_dev->fb_count > 1) - spin_lock(&sm750_dev->slock); + spin_lock(&sm750_dev->slock); sm750_dev->accel.de_copyarea(&sm750_dev->accel, base, pitch, region->sx, region->sy, base, pitch, Bpp, region->dx, region->dy, region->width, region->height, HW_ROP2_COPY); - if (sm750_dev->fb_count > 1) - spin_unlock(&sm750_dev->slock); + spin_unlock(&sm750_dev->slock); } static void lynxfb_ops_imageblit(struct fb_info *info, @@ -269,8 +265,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info, * If not use spin_lock, system will die if user load driver * and immediately unload driver frequently (dual) */ - if (sm750_dev->fb_count > 1) - spin_lock(&sm750_dev->slock); + spin_lock(&sm750_dev->slock); sm750_dev->accel.de_imageblit(&sm750_dev->accel, image->data, image->width >> 3, 0, @@ -278,8 +273,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info, image->dx, image->dy, image->width, image->height, fgcol, bgcol, HW_ROP2_COPY); - if (sm750_dev->fb_count > 1) - spin_unlock(&sm750_dev->slock); + spin_unlock(&sm750_dev->slock); } static int lynxfb_ops_pan_display(struct fb_var_screeninfo *var,