From patchwork Mon May 13 14:00:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2558681 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 64D933FD4E for ; Mon, 13 May 2013 14:00:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751230Ab3EMOAE (ORCPT ); Mon, 13 May 2013 10:00:04 -0400 Received: from mail-bk0-f53.google.com ([209.85.214.53]:64631 "EHLO mail-bk0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753369Ab3EMOAE (ORCPT ); Mon, 13 May 2013 10:00:04 -0400 Received: by mail-bk0-f53.google.com with SMTP id mx1so276043bkb.26 for ; Mon, 13 May 2013 07:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=W/6lg+4sfTP0gRhHrfyY1CQinfBjQiYEvUoA9crSPlU=; b=YgJTDYxJ0t7eh5UvBwFJAfe2cB88QJnf/lLbidwWDXA6ewNsTT3crDA8PumemKvnKf UDrkOGLJ0Wwhlp5HfYvViLpPZumghKUvK33XtVbx8V3wDhwAoV3hYZS9WIDm1rvmPaQp rJP395lQGLtWB0f8t2HjD4UsoU76g6+y3asV94qFOD5GbffmsrQ2bMfz9oFBuV6JTkZ6 RsAjK81xWgY69Ziv7k1vSx1P1g4/eA5aCbL1inp7OkHGn6Uj3pE0JnsrbjXV/WNzYIC1 MqEHA00OtIxOLcjrwO+1OWpCKlXzHaRpuw3w6AqU6O5SZAzk1IyUDsVtyE+odYfuCK01 3vJg== MIME-Version: 1.0 X-Received: by 10.204.62.137 with SMTP id x9mr5615731bkh.90.1368453601738; Mon, 13 May 2013 07:00:01 -0700 (PDT) Received: by 10.204.199.129 with HTTP; Mon, 13 May 2013 07:00:01 -0700 (PDT) Date: Mon, 13 May 2013 22:00:01 +0800 Message-ID: Subject: [PATCH v2] [media] sta2x11_vip: fix error return code in sta2x11_vip_init_one() From: Wei Yongjun To: mchehab@redhat.com, hans.verkuil@cisco.com, giancarlo.asnaghi@st.com, federico.vaga@gmail.com, prabhakar.csengg@gmail.com Cc: yongjun_wei@trendmicro.com.cn, linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Wei Yongjun The orig code will release all the resources if v4l2_device_register() failed and return 0. But what we need in this case is to return an negative error code to let the caller known we are failed. So the patch save the return value of v4l2_device_register() to 'ret' and return it when error. Signed-off-by: Wei Yongjun Acked-by: Federico Vaga --- v1 -> v2: change the commit message --- drivers/media/pci/sta2x11/sta2x11_vip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" 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/media/pci/sta2x11/sta2x11_vip.c b/drivers/media/pci/sta2x11/sta2x11_vip.c index 7005695..77edc11 100644 --- a/drivers/media/pci/sta2x11/sta2x11_vip.c +++ b/drivers/media/pci/sta2x11/sta2x11_vip.c @@ -1047,7 +1047,8 @@ static int sta2x11_vip_init_one(struct pci_dev *pdev, ret = sta2x11_vip_init_controls(vip); if (ret) goto free_mem; - if (v4l2_device_register(&pdev->dev, &vip->v4l2_dev)) + ret = v4l2_device_register(&pdev->dev, &vip->v4l2_dev); + if (ret) goto free_mem; dev_dbg(&pdev->dev, "BAR #0 at 0x%lx 0x%lx irq %d\n",