From patchwork Tue Feb 23 12:44:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 8391351 Return-Path: X-Original-To: patchwork-linux-fbdev@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 940A6C0553 for ; Tue, 23 Feb 2016 12:44:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2C3320328 for ; Tue, 23 Feb 2016 12:44:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DBB7420303 for ; Tue, 23 Feb 2016 12:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751711AbcBWMo2 (ORCPT ); Tue, 23 Feb 2016 07:44:28 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:35828 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751452AbcBWMo1 (ORCPT ); Tue, 23 Feb 2016 07:44:27 -0500 Received: by mail-pf0-f180.google.com with SMTP id c10so115621964pfc.2; Tue, 23 Feb 2016 04:44:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=vzuoohcB6gAF4Oy1TMa1o+Pc33kkjZroayQL3SUc64Y=; b=lsgLBvDcvTC9M+4Bpqf3YULsO8uppYuZjvF9Jv0dom9BKTF+1l18nYLZgndulRkkpM yAaq5faMuRHkyHZyMByfxhyjnR7/TnedZyZgzcZQ5krLid409ymE4znuvnZtc0i4VaNW b4hm63psFI6OGjCUrw11AvihiSFqLimOp7EVUD9sO74xD22QttN7JWklkjSYHOQfb1Ig Z+i+WxRhQl/kjTZjd4hYE8YqMb+hahb0jZLynNlCepVDV4LR2l5549o268eMv3skkl4r VvuCz7DE8t496hdAomC5fLwr+/R/8BwLpEUhwypJJOnaIXlnxVG+5JnFBqBLAUstuOhZ TSkQ== 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; bh=vzuoohcB6gAF4Oy1TMa1o+Pc33kkjZroayQL3SUc64Y=; b=MRhWJCSMxl/pCoUGbNjPItpTHdetn+YiSf+FoSltvnpWE7dyRVr9dnxC0W5r9xKpgq I0wS6OTHHQOPJQNO9e6NMxn8DXN2JizFLIUFGNPGT+JX16bxAqbGmZjQPphZRXOtnvSf 4J2hjUZwGQZYJxAVi/nYgFWledNNQRpyGJ6/z1sVJbPvZc6ZcpvrB3nHscnv1e+CdlzZ 2LgIsNKY7ll0nhWx/XAIsAEM2IJIXkHCUyGcArBHWT7yXgd9SoSfAK7faZrolE8GUr/x G9LZNnphxUEV+RHZE6bzHbe74Lz18Rxppt+4TWSv0OiXq9zxVHKJNd8Y6ybuROV59dRe yoxQ== X-Gm-Message-State: AG10YORgbMsG+6JmOdVBFx5PQ5j0tFM2kOPpiBc7BsztKhWYbzwEH8TR3bnKXdllPPmO6g== X-Received: by 10.98.76.194 with SMTP id e63mr45913980pfj.9.1456231466924; Tue, 23 Feb 2016 04:44:26 -0800 (PST) Received: from sudip-pc.vectortproxy.org ([14.195.229.154]) by smtp.gmail.com with ESMTPSA id tn5sm44257586pac.32.2016.02.23.04.44.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Feb 2016 04:44:26 -0800 (PST) From: Sudip Mukherjee To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, Sudip Mukherjee Subject: [PATCH] fbdev: n411: check return value Date: Tue, 23 Feb 2016 18:14:17 +0530 Message-Id: <1456231457-20806-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@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 We were not checking the return value of platform_device_add_data() which can fail. Signed-off-by: Sudip Mukherjee --- drivers/video/fbdev/n411.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/n411.c b/drivers/video/fbdev/n411.c index 935830f..053deac 100644 --- a/drivers/video/fbdev/n411.c +++ b/drivers/video/fbdev/n411.c @@ -165,16 +165,22 @@ static int __init n411_init(void) if (!n411_device) return -ENOMEM; - platform_device_add_data(n411_device, &n411_board, sizeof(n411_board)); + ret = platform_device_add_data(n411_device, &n411_board, + sizeof(n411_board)); + if (ret) + goto put_plat_device; /* this _add binds hecubafb to n411. hecubafb refcounts n411 */ ret = platform_device_add(n411_device); if (ret) - platform_device_put(n411_device); + goto put_plat_device; - return ret; + return 0; +put_plat_device: + platform_device_put(n411_device); + return ret; } static void __exit n411_exit(void)