2015-12-04 09:21:43

by Shah, Yash (Y.)

[permalink] [raw]
Subject: [PATCH] Staging: cdrom: fix space required after that ','

From: Yash Shah<[email protected]>

fix space required after that ',' as detected by checkpatch.pl

Signed-off-by: Yash Shah <[email protected]>
---
drivers/cdrom/cdrom.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index c206ccd..2d759b6 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -536,7 +536,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi)
int ret;

ret = cdrom_get_disc_info(cdi, &di);
- if (ret < 0 || ret < (int)offsetof(typeof(di),disc_type))
+ if (ret < 0 || ret < (int)offsetof(typeof(di), disc_type))
return 1;

ret = 0;
@@ -788,7 +788,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
}

ret = cdrom_get_disc_info(cdi, &di);
- if (ret < 0 || ret < offsetof(typeof(di),disc_type))
+ if (ret < 0 || ret < offsetof(typeof(di), disc_type))
return 1;

if (!di.erasable)
@@ -1050,7 +1050,7 @@ int open_for_data(struct cdrom_device_info *cdi)
if (CDROM_CAN(CDC_CLOSE_TRAY) &&
cdi->options & CDO_AUTO_CLOSE) {
cd_dbg(CD_OPEN, "trying to close the tray\n");
- ret=cdo->tray_move(cdi,0);
+ ret=cdo->tray_move(cdi, 0);
if (ret) {
cd_dbg(CD_OPEN, "bummer. tried to close the tray but failed.\n");
/* Ignore the error from the low
@@ -1215,7 +1215,7 @@ static int check_for_audio_disc(struct cdrom_device_info * cdi,
if (CDROM_CAN(CDC_CLOSE_TRAY) &&
cdi->options & CDO_AUTO_CLOSE) {
cd_dbg(CD_OPEN, "trying to close the tray\n");
- ret=cdo->tray_move(cdi,0);
+ ret=cdo->tray_move(cdi, 0);
if (ret) {
cd_dbg(CD_OPEN, "bummer. tried to close tray but failed.\n");
/* Ignore the error from the low
@@ -1591,8 +1591,8 @@ void init_cdrom_command(struct packet_command *cgc, void *buf, int len,

/* DVD handling */

-#define copy_key(dest,src) memcpy((dest), (src), sizeof(dvd_key))
-#define copy_chal(dest,src) memcpy((dest), (src), sizeof(dvd_challenge))
+#define copy_key(dest, src) memcpy((dest), (src), sizeof(dvd_key))
+#define copy_chal(dest, :src) memcpy((dest), (src), sizeof(dvd_challenge))

static void setup_report_key(struct packet_command *cgc, unsigned agid, unsigned type)
{
--
1.9.1


2015-12-04 09:34:02

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] Staging: cdrom: fix space required after that ','

Hi Yash,

[auto build test ERROR on v4.4-rc3]
[also build test ERROR on next-20151203]

url: https://github.com/0day-ci/linux/commits/Shah-Yash-Y/Staging-cdrom-fix-space-required-after-that/20151204-172315
config: x86_64-randconfig-x015-12041303 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

drivers/cdrom/cdrom.c:1595:25: sparse: ":" may not appear in macro parameter list
drivers/cdrom/cdrom.c:1684:17: sparse: undefined identifier 'copy_chal'
drivers/cdrom/cdrom.c:1723:17: sparse: undefined identifier 'copy_chal'
>> drivers/cdrom/cdrom.c:1595:25: error: ":" may not appear in macro parameter list
#define copy_chal(dest, :src) memcpy((dest), (src), sizeof(dvd_challenge))
^
drivers/cdrom/cdrom.c: In function 'dvd_do_auth':
>> drivers/cdrom/cdrom.c:1684:3: error: implicit declaration of function 'copy_chal' [-Werror=implicit-function-declaration]
copy_chal(ai->lsc.chal, &buf[4]);
^
cc1: some warnings being treated as errors

vim +1595 drivers/cdrom/cdrom.c

1589 cgc->timeout = CDROM_DEF_TIMEOUT;
1590 }
1591
1592 /* DVD handling */
1593
1594 #define copy_key(dest, src) memcpy((dest), (src), sizeof(dvd_key))
> 1595 #define copy_chal(dest, :src) memcpy((dest), (src), sizeof(dvd_challenge))
1596
1597 static void setup_report_key(struct packet_command *cgc, unsigned agid, unsigned type)
1598 {
1599 cgc->cmd[0] = GPCMD_REPORT_KEY;
1600 cgc->cmd[10] = type | (agid << 6);
1601 switch (type) {
1602 case 0: case 8: case 5: {
1603 cgc->buflen = 8;
1604 break;
1605 }
1606 case 1: {
1607 cgc->buflen = 16;
1608 break;
1609 }
1610 case 2: case 4: {
1611 cgc->buflen = 12;
1612 break;
1613 }
1614 }
1615 cgc->cmd[9] = cgc->buflen;
1616 cgc->data_direction = CGC_DATA_READ;
1617 }
1618
1619 static void setup_send_key(struct packet_command *cgc, unsigned agid, unsigned type)
1620 {
1621 cgc->cmd[0] = GPCMD_SEND_KEY;
1622 cgc->cmd[10] = type | (agid << 6);
1623 switch (type) {
1624 case 1: {
1625 cgc->buflen = 16;
1626 break;
1627 }
1628 case 3: {
1629 cgc->buflen = 12;
1630 break;
1631 }
1632 case 6: {
1633 cgc->buflen = 8;
1634 break;
1635 }
1636 }
1637 cgc->cmd[9] = cgc->buflen;
1638 cgc->data_direction = CGC_DATA_WRITE;
1639 }
1640
1641 static int dvd_do_auth(struct cdrom_device_info *cdi, dvd_authinfo *ai)
1642 {
1643 int ret;
1644 u_char buf[20];
1645 struct packet_command cgc;
1646 struct cdrom_device_ops *cdo = cdi->ops;
1647 rpc_state_t rpc_state;
1648
1649 memset(buf, 0, sizeof(buf));
1650 init_cdrom_command(&cgc, buf, 0, CGC_DATA_READ);
1651
1652 switch (ai->type) {
1653 /* LU data send */
1654 case DVD_LU_SEND_AGID:
1655 cd_dbg(CD_DVD, "entering DVD_LU_SEND_AGID\n");
1656 cgc.quiet = 1;
1657 setup_report_key(&cgc, ai->lsa.agid, 0);
1658
1659 if ((ret = cdo->generic_packet(cdi, &cgc)))
1660 return ret;
1661
1662 ai->lsa.agid = buf[7] >> 6;
1663 /* Returning data, let host change state */
1664 break;
1665
1666 case DVD_LU_SEND_KEY1:
1667 cd_dbg(CD_DVD, "entering DVD_LU_SEND_KEY1\n");
1668 setup_report_key(&cgc, ai->lsk.agid, 2);
1669
1670 if ((ret = cdo->generic_packet(cdi, &cgc)))
1671 return ret;
1672
1673 copy_key(ai->lsk.key, &buf[4]);
1674 /* Returning data, let host change state */
1675 break;
1676
1677 case DVD_LU_SEND_CHALLENGE:
1678 cd_dbg(CD_DVD, "entering DVD_LU_SEND_CHALLENGE\n");
1679 setup_report_key(&cgc, ai->lsc.agid, 1);
1680
1681 if ((ret = cdo->generic_packet(cdi, &cgc)))
1682 return ret;
1683
> 1684 copy_chal(ai->lsc.chal, &buf[4]);
1685 /* Returning data, let host change state */
1686 break;
1687

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (4.04 kB)
.config.gz (20.89 kB)
Download all attachments

2015-12-04 10:37:36

by Geyslan G. Bem

[permalink] [raw]
Subject: Re: [PATCH] Staging: cdrom: fix space required after that ','

Hi Yash,

2015-12-04 6:21 GMT-03:00 Shah, Yash (Y.) <[email protected]>:
> From: Yash Shah<[email protected]>
>
> fix space required after that ',' as detected by checkpatch.pl
>
> Signed-off-by: Yash Shah <[email protected]>
> ---
> drivers/cdrom/cdrom.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
> index c206ccd..2d759b6 100644
> --- a/drivers/cdrom/cdrom.c
> +++ b/drivers/cdrom/cdrom.c
> @@ -536,7 +536,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi)
> int ret;
>
> ret = cdrom_get_disc_info(cdi, &di);
> - if (ret < 0 || ret < (int)offsetof(typeof(di),disc_type))
> + if (ret < 0 || ret < (int)offsetof(typeof(di), disc_type))
> return 1;
>
> ret = 0;
> @@ -788,7 +788,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
> }
>
> ret = cdrom_get_disc_info(cdi, &di);
> - if (ret < 0 || ret < offsetof(typeof(di),disc_type))
> + if (ret < 0 || ret < offsetof(typeof(di), disc_type))
> return 1;
>
> if (!di.erasable)
> @@ -1050,7 +1050,7 @@ int open_for_data(struct cdrom_device_info *cdi)
> if (CDROM_CAN(CDC_CLOSE_TRAY) &&
> cdi->options & CDO_AUTO_CLOSE) {
> cd_dbg(CD_OPEN, "trying to close the tray\n");
> - ret=cdo->tray_move(cdi,0);
> + ret=cdo->tray_move(cdi, 0);

What do you think to add spaces between equal assignment too?

> if (ret) {
> cd_dbg(CD_OPEN, "bummer. tried to close the tray but failed.\n");
> /* Ignore the error from the low
> @@ -1215,7 +1215,7 @@ static int check_for_audio_disc(struct cdrom_device_info * cdi,
> if (CDROM_CAN(CDC_CLOSE_TRAY) &&
> cdi->options & CDO_AUTO_CLOSE) {
> cd_dbg(CD_OPEN, "trying to close the tray\n");
> - ret=cdo->tray_move(cdi,0);
> + ret=cdo->tray_move(cdi, 0);
> if (ret) {
> cd_dbg(CD_OPEN, "bummer. tried to close tray but failed.\n");
> /* Ignore the error from the low
> @@ -1591,8 +1591,8 @@ void init_cdrom_command(struct packet_command *cgc, void *buf, int len,
>
> /* DVD handling */
>
> -#define copy_key(dest,src) memcpy((dest), (src), sizeof(dvd_key))
> -#define copy_chal(dest,src) memcpy((dest), (src), sizeof(dvd_challenge))
> +#define copy_key(dest, src) memcpy((dest), (src), sizeof(dvd_key))
> +#define copy_chal(dest, :src) memcpy((dest), (src), sizeof(dvd_challenge))
>
> static void setup_report_key(struct packet_command *cgc, unsigned agid, unsigned type)
> {
> --
> 1.9.1
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/



--
Regards,

Geyslan G. Bem
hackingbits.com

2015-12-04 10:49:44

by Shah, Yash (Y.)

[permalink] [raw]
Subject: RE: [PATCH] Staging: cdrom: fix space required after that ','

Hi,

Ok I will send all the spaces related error in one single patch.

Thanks,
Yash Shah

-----Original Message-----
From: Geyslan G. Bem [mailto:[email protected]]
Sent: Friday, December 04, 2015 4:08 PM
To: Shah, Yash (Y.)
Cc: [email protected]; [email protected]; Babu, Viswanathan (V.)
Subject: Re: [PATCH] Staging: cdrom: fix space required after that ','

Hi Yash,

2015-12-04 6:21 GMT-03:00 Shah, Yash (Y.) <[email protected]>:
> From: Yash Shah<[email protected]>
>
> fix space required after that ',' as detected by checkpatch.pl
>
> Signed-off-by: Yash Shah <[email protected]>
> ---
> drivers/cdrom/cdrom.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index
> c206ccd..2d759b6 100644
> --- a/drivers/cdrom/cdrom.c
> +++ b/drivers/cdrom/cdrom.c
> @@ -536,7 +536,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi)
> int ret;
>
> ret = cdrom_get_disc_info(cdi, &di);
> - if (ret < 0 || ret < (int)offsetof(typeof(di),disc_type))
> + if (ret < 0 || ret < (int)offsetof(typeof(di), disc_type))
> return 1;
>
> ret = 0;
> @@ -788,7 +788,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
> }
>
> ret = cdrom_get_disc_info(cdi, &di);
> - if (ret < 0 || ret < offsetof(typeof(di),disc_type))
> + if (ret < 0 || ret < offsetof(typeof(di), disc_type))
> return 1;
>
> if (!di.erasable)
> @@ -1050,7 +1050,7 @@ int open_for_data(struct cdrom_device_info *cdi)
> if (CDROM_CAN(CDC_CLOSE_TRAY) &&
> cdi->options & CDO_AUTO_CLOSE) {
> cd_dbg(CD_OPEN, "trying to close the tray\n");
> - ret=cdo->tray_move(cdi,0);
> + ret=cdo->tray_move(cdi, 0);

What do you think to add spaces between equal assignment too?

> if (ret) {
> cd_dbg(CD_OPEN, "bummer. tried to close the tray but failed.\n");
> /* Ignore the error from the
> low @@ -1215,7 +1215,7 @@ static int check_for_audio_disc(struct cdrom_device_info * cdi,
> if (CDROM_CAN(CDC_CLOSE_TRAY) &&
> cdi->options & CDO_AUTO_CLOSE) {
> cd_dbg(CD_OPEN, "trying to close the tray\n");
> - ret=cdo->tray_move(cdi,0);
> + ret=cdo->tray_move(cdi, 0);
> if (ret) {
> cd_dbg(CD_OPEN, "bummer. tried to close tray but failed.\n");
> /* Ignore the error from the
> low @@ -1591,8 +1591,8 @@ void init_cdrom_command(struct
> packet_command *cgc, void *buf, int len,
>
> /* DVD handling */
>
> -#define copy_key(dest,src) memcpy((dest), (src), sizeof(dvd_key))
> -#define copy_chal(dest,src) memcpy((dest), (src), sizeof(dvd_challenge))
> +#define copy_key(dest, src) memcpy((dest), (src), sizeof(dvd_key))
> +#define copy_chal(dest, :src) memcpy((dest), (src),
> +sizeof(dvd_challenge))
>
> static void setup_report_key(struct packet_command *cgc, unsigned
> agid, unsigned type) {
> --
> 1.9.1
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/



--
Regards,

Geyslan G. Bem
hackingbits.com
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2015-12-04 16:43:44

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] Staging: cdrom: fix space required after that ','

On 12/04/2015 02:21 AM, Shah, Yash (Y.) wrote:
> From: Yash Shah<[email protected]>
>
> -#define copy_key(dest,src) memcpy((dest), (src), sizeof(dvd_key))
> -#define copy_chal(dest,src) memcpy((dest), (src), sizeof(dvd_challenge))
> +#define copy_key(dest, src) memcpy((dest), (src), sizeof(dvd_key))
> +#define copy_chal(dest, :src) memcpy((dest), (src), sizeof(dvd_challenge))

Sending patches that you haven't even compiled:

https://www.youtube.com/watch?v=y94KynIg-g8

--
Jens Axboe

2015-12-04 16:49:29

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] Staging: cdrom: fix space required after that ','

On 12/04/2015 03:49 AM, Shah, Yash (Y.) wrote:
> Hi,
>
> Ok I will send all the spaces related error in one single patch.

No top posting, please.

And don't send anymore of these patches, unless you automate it with
coccinelle. As this previous attempt elegantly demonstrated, the risk of
introducing errors is too high, and reviewing patches like this is very
error prone.

--
Jens Axboe