From patchwork Mon May 26 22:46:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 4245701 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 021979F333 for ; Mon, 26 May 2014 22:46:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 419212013A for ; Mon, 26 May 2014 22:46:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7903D200E5 for ; Mon, 26 May 2014 22:46:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751603AbaEZWqz (ORCPT ); Mon, 26 May 2014 18:46:55 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:50878 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751498AbaEZWqy (ORCPT ); Mon, 26 May 2014 18:46:54 -0400 Received: from avalon.ideasonboard.com (30.141-246-81.adsl-dyn.isp.belgacom.be [81.246.141.30]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CF74835A00 for ; Tue, 27 May 2014 00:46:42 +0200 (CEST) From: Laurent Pinchart To: linux-media@vger.kernel.org Subject: [PATCH] v4l: vsp1: sru: Handle control handler initialization errors Date: Tue, 27 May 2014 00:46:49 +0200 Message-Id: <1401144409-13217-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 1.8.5.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 Bail out when the SRU control handler fails to initialize. Signed-off-by: Laurent Pinchart Acked-by: Sakari Ailus --- drivers/media/platform/vsp1/vsp1_sru.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c index aa0e04c..79efcaf 100644 --- a/drivers/media/platform/vsp1/vsp1_sru.c +++ b/drivers/media/platform/vsp1/vsp1_sru.c @@ -348,6 +348,14 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1) /* Initialize the control handler. */ v4l2_ctrl_handler_init(&sru->ctrls, 1); v4l2_ctrl_new_custom(&sru->ctrls, &sru_intensity_control, NULL); + + if (sru->ctrls.error) { + dev_err(vsp1->dev, "sru: failed to initialize controls\n"); + ret = sru->ctrls.error; + v4l2_ctrl_handler_free(&sru->ctrls); + return ERR_PTR(ret); + } + v4l2_ctrl_handler_setup(&sru->ctrls); sru->entity.subdev.ctrl_handler = &sru->ctrls;