From patchwork Mon Apr 27 09:22:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 6278911 Return-Path: X-Original-To: patchwork-linux-spi@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 E3AD2BF4A6 for ; Mon, 27 Apr 2015 09:19:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 312E5203C3 for ; Mon, 27 Apr 2015 09:19:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 580942041D for ; Mon, 27 Apr 2015 09:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932377AbbD0JTM (ORCPT ); Mon, 27 Apr 2015 05:19:12 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:33818 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932169AbbD0JTL (ORCPT ); Mon, 27 Apr 2015 05:19:11 -0400 Received: by pacyx8 with SMTP id yx8so123062437pac.1 for ; Mon, 27 Apr 2015 02:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=G7h29Bc0bYuBt2VZpEuToH3LSG6pO4meN8yfQAs8NYo=; b=HrnXuTGmRwpjmTUFZ+lKCMigt6DtxDRek06I5z4UprwNr+WrWhMmklnEnctV9PN38z CmeABgWIUfcXsjBS4KA69W0jQPYdN26/MObyYGePQkYpYhe8AaDBBcN8iiLEOgvYvIh1 j5nT0z/FUWj1M5PIqWvTENvkBO4YQDG7KkxKpsoGIp29NmYVRqcUYjMp3JuAhOQJVEJ9 XwDB39BQ3e/WXxYGh7aGYKajrZAZA9l8rrrJhTQ2jsW40qmR0ypPeR6pISjd0GDL1fY/ G7x2x0dHhdi9XQ36dAQdduo5G0e85z4TRbdI7TnIsruTyK38/a6BcCIPdwHSgMpw2UVn q+rQ== X-Received: by 10.66.139.167 with SMTP id qz7mr20384546pab.135.1430126351249; Mon, 27 Apr 2015 02:19:11 -0700 (PDT) Received: from ip-172-31-29-47.ap-northeast-1.compute.internal (ec2-54-65-106-64.ap-northeast-1.compute.amazonaws.com. [54.65.106.64]) by mx.google.com with ESMTPSA id nb10sm18749148pdb.76.2015.04.27.02.19.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Apr 2015 02:19:10 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: broonie@kernel.org, linux-spi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, workgroup.linux@csr.com, Qipan Li , Barry Song Subject: [PATCH] spi: sirf: replace BUG condition by error code for unsupported transfer Date: Mon, 27 Apr 2015 09:22:28 +0000 Message-Id: <1430126548-8171-1-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@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, T_DKIM_INVALID, T_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 From: Qipan Li return error for unsupported bits-per-word format, BUG() is not right for this scenerios as we are not an ASSERT but an error handler. Signed-off-by: Qipan Li Signed-off-by: Barry Song --- drivers/spi/spi-sirf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index f5715c9..a50ee9b 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -559,7 +559,8 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) sspi->tx_word = spi_sirfsoc_tx_word_u32; break; default: - BUG(); + dev_err(&spi->dev, "bpw %d not supported\n", bits_per_word); + return -EINVAL; } sspi->word_width = DIV_ROUND_UP(bits_per_word, 8);