From patchwork Wed Mar 27 20:08:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 2353041 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 64CD03FD40 for ; Wed, 27 Mar 2013 20:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754472Ab3C0UIY (ORCPT ); Wed, 27 Mar 2013 16:08:24 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:38916 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754218Ab3C0UIY (ORCPT ); Wed, 27 Mar 2013 16:08:24 -0400 Received: by mail-pa0-f41.google.com with SMTP id kx1so1864975pab.0 for ; Wed, 27 Mar 2013 13:08:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:subject:from:to:cc:date:content-type:x-mailer :content-transfer-encoding:mime-version; bh=3YK3DY7naLT4T+7Ff/raZZF3mPsZGXfUtAf+eTwRT+8=; b=gywnOlIuY4VRdRJaWZxZwTj+7u6GDHegeZeEcOtaIhIUMzsK46QokjcxeqoFmQg43E Xh8ApdMwlYCkNXstJgqui9033yV0Rqt2qeTxmR9fMO0cy7iO7NqwP+jnvTtojDs8b4TY Dwh04ugIUNRWmZxkqcyk2ZcploW4eRHHOrtGcYE1Qbb79vxZHLSI+5TPXgyxZiLtzLrb oK5xo/w8jAFzKL49csKwCdU2uvf+8d479y9qlMlupMbw91y0BM5F5qbWTmTEvXRH53xg OGklvapgMZD5nzKhrDhYRLmgtbTVTq8R9ZckZg16CsmVDaDVO6kbD1CY+zAWFVejJkq2 1Rug== X-Received: by 10.66.164.97 with SMTP id yp1mr31871635pab.49.1364414903447; Wed, 27 Mar 2013 13:08:23 -0700 (PDT) Received: from [61.83.230.213] ([61.83.230.213]) by mx.google.com with ESMTPS id t1sm24559814pab.12.2013.03.27.13.08.20 (version=SSLv3 cipher=RC4-SHA bits=128/128); Wed, 27 Mar 2013 13:08:22 -0700 (PDT) Message-ID: <1364414899.3909.25.camel@samsungRC530> Subject: [patch 2/2] media: radio-ma901: return ENODEV in probe if usb_device doesn't match From: Alexey Klimov To: mchehab@redhat.com Cc: jkosina@suse.cz, linux-input@vger.kernel.org, linux@wagner-budenheim.de, klimov.linux@gmail.com, linux-media@vger.kernel.org Date: Thu, 28 Mar 2013 00:08:19 +0400 X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Masterkit MA901 usb radio device shares USB ID with Atmel V-USB devices. This patch adds additional checks in usb_ma901radio_probe() and if product or manufacturer doesn't match we return -ENODEV and don't continue. This allows hid drivers to handle not MA901 device. Signed-off-by: Alexey Klimov --- 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/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c index c61f590..348dafc 100644 --- a/drivers/media/radio/radio-ma901.c +++ b/drivers/media/radio/radio-ma901.c @@ -347,9 +347,20 @@ static void usb_ma901radio_release(struct v4l2_device *v4l2_dev) static int usb_ma901radio_probe(struct usb_interface *intf, const struct usb_device_id *id) { + struct usb_device *dev = interface_to_usbdev(intf); struct ma901radio_device *radio; int retval = 0; + /* Masterkit MA901 usb radio has the same USB ID as many others + * Atmel V-USB devices. Let's make additional checks to be sure + * that this is our device. + */ + + if (dev->product && dev->manufacturer && + (strncmp(dev->product, "MA901", 5) != 0 + || strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0)) + return -ENODEV; + radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); if (!radio) { dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n");